我正在使用此方法来保存我的游戏设置
我什么时候应该使用saveTabel和loadTable
如果我在应用程序启动时使用saveTable,它会保存表的默认值,但是如何在应用程序再次启动时加载上次保存的valeus.
我可以使用(if)检查文件是否存在吗?
请帮忙
提前致谢!
我需要显示从00:10到00:09而不是00:9的倒计时.如何确保给定数字显示两位数而不诉诸繁琐的if语句?
我需要send在我的一个Corona应用程序中按下电子邮件按钮时检测到该事件.我指的是撰写电子邮件和短信(2012年1月3日发布.由Jonathan Beebe撰写).但无法找到任何此类方法.
该行为类似于:
-(void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
Run Code Online (Sandbox Code Playgroud)
的Objective-C.
编辑:我也在添加示例图像:
任何帮助都很明显......
我正在尝试使用本地通知系统实现应用程序.系统应取消一些不必要的通知.System.scheduleNotification工作正常(它创建通知,它们工作正常)但它返回nil(它应该返回一个ID).所以我无法通过通知ID取消任何通知.
实际上我使用的代码非常简单.任何帮助都会有所帮助......
local nextRefreshTime = 60 -- Not always 60, its just an example
local options = {
alert = "Some text here.",
badge = ( native.getProperty( "applicationIconBadgeNumber" ) or 0 ) + 1,
}
notifications[#notifications+1] = system.scheduleNotification( nextRefreshTime, options )
print(notifications[#notifications]) -- Prints nil !?!
-- Another example (test)
print( system.scheduleNotification( nextRefreshTime, options ) ) -- Also prints nil !?!
Run Code Online (Sandbox Code Playgroud)
ps:我也尝试system.scheduleNotification过utcTime参数.
对于这个功能fallingCoins(),我在代码中向后移动硬币,当锚点接触硬币时我需要隐藏这些硬币.
function fallingCoins()
local myPlayer = display.newCircle( math.random(20,_W+20), -25, math.random(10,10) )
myPlayer:setStrokeColor(255, 128, 0 )
myPlayer:setFillColor(math.random(245,255),math.random(210,223),7)
myPlayer.myName = "myPlayer"
physics.addBody( myPlayer, "static" )
myPlayer.y = "150"
local function muovi()
myPlayer:translate(-2, 0)
end
Runtime:addEventListener( "enterFrame", muovi );
end
timer.performWithDelay( 3000, fallingCoins )
Run Code Online (Sandbox Code Playgroud)
如果碰到锚,我就会隐藏硬币.
function onCollision3( event )
if(event.object1.myName == "guy" and event.object2.myName == "myPlayer") then
event.object2:removeSelf();
end
end
Runtime:addEventListener( "collision", onCollision3 )
Run Code Online (Sandbox Code Playgroud)
如果我触摸硬币然后我就会收到此错误
"---------------------------
Corona Runtime Error
---------------------------
...as\desktop\run2\scroll\scrolling background\main.lua:123: attempt to call method 'translate' (a nil value)
stack …Run Code Online (Sandbox Code Playgroud) 当我运行代码时,它告诉我有一个错误')' expected near '=':
function restartLvl()
for i = 1, #balloonTexts do
display.remove(balloonTexts[i])
print ("restart level")
end
score.text = '0'
ballRemain.text = '3'
balloonText = {}
createBalloons(1, 3)
if (askUser.isVisible = true) then --this is the line where the error occured
askUser.isVisible = false
end
if (yesBtn.isVisible = true) then
yesBtn.isVisible = false
end
if (noBtn.isVisible = true) then
noBtn.isVisible = false
end
end
Run Code Online (Sandbox Code Playgroud)
我不知道它是如何仍然缺少' )',因为我关闭了所有括号.
我试图从斯洛伐克语中的一个单词串中提取字符.例如,"TURTLE"一词是"KORYTNAČKA".但是,当我尝试从字符串中提取它时,它会跳过"Č"字符:
local str = "KORYTNA?KA"
for c in str:gmatch("%a") do print(c) end
--result: K,O,R,Y,T,N,A,K,A
Run Code Online (Sandbox Code Playgroud)
我正在阅读这个页面,我也尝试将字符串本身作为一个集合粘贴,但它提出了一些奇怪的东西:
local str = "KORYTNA?KA"
for c in str:gmatch("["..str.."]") do print(c) end
--result: K,O,R,Y,T,N,A,Ä,Œ,K,A
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这个问题?
我目前正在制作一个Corona应用,我想在其中添加日语文本。对于不认识的人来说,日语似乎有多种语言可以写文字(汉字,平假名等)。Furigana是一种在平假名中包含汉字字符和平假名的方法(或Ruby字符)。有关示例,请参见本页上的Ruby幻灯片。
我正在寻找在我的应用程序中使用Furigana的方法。我希望有一种使用Unicode的方法。好吧,我偶然发现了Interlinear注释字符,并在Corona中对其进行了测试(使用unicodeToUtf8和LastResort字体),如下所示:
local iaAnchor = unicodeToUtf8(0xfff9)
local iaSep = unicodeToUtf8(0xfffa)
local iaTerm = unicodeToUtf8(0xfffb)
local options = {
parent = localGroup,
text = iaAnchor .. "?" .. iaSep .. "??" .. iaTerm .. iaAnchor .."?" .. iaSep .. "?" .. iaTerm,
x = 285,
y = 195,
font = "LastResort",
fontSize = 24,
}
local testText = display.newText(options)
Run Code Online (Sandbox Code Playgroud)
不幸的是,我没有成功,最终得到了这样的东西:

我碰到了像这样的桌子,键周围有方括号。我知道使用lua不需要使用lua ..使用方括号时有什么区别吗?
local commands_json =
{
["request"] = {
["application"] = PW_APPLICATION,
["push_token"] = deviceToken,
["language"] = "en", --OR: system.getPreference( "ui", "language" ),
["hwid"] = system.getInfo("deviceID"),
["timezone"] = -3600, --offset in seconds
["device_type"] = deviceType
}
}
Run Code Online (Sandbox Code Playgroud) 我正试图唤醒手机或使用GCM让灯光闪烁.我收到的信息很好,但是设置高优先级或根本没有优先权.我正在使用razr maxx hd进行测试.这里有什么我想念的吗?
<?php
// API access key from Google API's Console
define('API_ACCESS_KEY', 'blee');
// prep the bundle
$msg = array
(
'body' => 'this is my nice body',
'sound' => 'misc/androidnotification.mp3',
'custom' => array(
'route' => '/beee'
)
);
$fields = array
(
'collapse_key' => 'test',
"time_to_live" => 0,
'priority' => 'high',
'to' => 'mykey',
'data' => $msg,
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, …Run Code Online (Sandbox Code Playgroud)