- Update sources
This commit is contained in:
@@ -212,7 +212,10 @@ if JS then
|
|||||||
});
|
});
|
||||||
]]
|
]]
|
||||||
), function(data) print("In callback: " .. data); res=data end)
|
), function(data) print("In callback: " .. data); res=data end)
|
||||||
repeat love.timer.sleep(0.01) until res
|
repeat
|
||||||
|
love.timer.sleep(0.01)
|
||||||
|
JS.retrieveData(0.01)
|
||||||
|
until res
|
||||||
print("In lua: " .. res)
|
print("In lua: " .. res)
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,16 +23,11 @@ end
|
|||||||
--If you pass arguments to the func beyond the string, it will perform automatically string.format
|
--If you pass arguments to the func beyond the string, it will perform automatically string.format
|
||||||
--Return statement is possible inside this structure
|
--Return statement is possible inside this structure
|
||||||
--This will return a string containing a function to be called by JS.callJS
|
--This will return a string containing a function to be called by JS.callJS
|
||||||
local _unpack
|
|
||||||
if(_VERSION == "Lua 5.1" or _VERSION == "LuaJIT") then
|
|
||||||
_unpack = unpack
|
|
||||||
else
|
|
||||||
_unpack = table.unpack
|
|
||||||
end
|
|
||||||
function JS.stringFunc(str, ...)
|
function JS.stringFunc(str, ...)
|
||||||
str = "(function(){"..str.."})()"
|
str = "(function(){"..str.."})()"
|
||||||
if(#arg > 0) then
|
if(#arg > 0) then
|
||||||
str = str:format(_unpack(arg))
|
str = str:format(unpack(arg))
|
||||||
end
|
end
|
||||||
str = str:gsub("[\n\t]", "")
|
str = str:gsub("[\n\t]", "")
|
||||||
return str
|
return str
|
||||||
|
|||||||
Reference in New Issue
Block a user