is there a way to define {} and blankspace as a lua code block?
something like this..
function()
{
local x = 3
if (x == 1) { print("hi1") }
elseif (x == 2) print("hi2")
else (x == 3) print("hi3")
}
it would also be nice to define things like ++ and += too
Just use do..end
. +=
operator and friends aren't conformant with spirit of Lua. Your code will not run. First of all, you need to understand basic Lua syntax. Example of corrected code:
function f()
local x = 3
if x == 1 then
print("hi1")
elseif x == 2 then
print("hi2")
elseif x == 3 then
print("hi3")
end
end
To create block simply use
do
print('Hello, world!')
end
You can check out Lua manual here , whenever you run to trouble.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.