-
Notifications
You must be signed in to change notification settings - Fork 0
Lua vs JS
Gentilhomme edited this page Apr 18, 2020
·
1 revision
myVar = "foo" -- global var
local foo = "bar" -- local to the current scope
local myVar = nil
if (myVar !== 10) {
}
if myVar ~= 10 then
end
local myBool = true
if not myBool then
end
{
// do work here
}
do
-- do work here
end
const myObject = {
foo: "bar"
}
for (const [key, value] of Object.entries(myObject)) {
console.log(key, value);
}
local myObject = {
foo = "bar"
}
for k,v in pairs(myObject) do
print(k, v)
end
const arr = [1, 2, 3]
for (const value of arr) {
}
const arr = {1, 2, 3}
for _, v of pairs(arr) do
end
-- or
local arrLength = #arr -- use # to get the length of the array
for index = 1, arrLength do
print (arr[index])
end
const foo = cond || defaultValue;
const x = cond ? a : b;
local foo = cond or defaultValue
local x = cond and a or b
myClass.method()
myClass:method()
"stringA" + "stringB"
"stringA" .. "stringB"
function foo(a, ...)
local args = {...}
return 1, 2, 3
end
local a, b, c = foo(10, "blabla", "foo")
Télechargement de la framework : http://lib.antarka.com/UnitedFrameworks.zip