I'm now starting to study the load() function in lua, and I'm having trouble getting the value that the function returns
I tried these two ways to execute a function with load() and collect their value
function sumvalues()
return 5+3
end
local func = "sumvalues()"
print(load(func))
local func = "return 5+3"
print(load(func))
but they only return the function, not the value returned from them
function: 0000000000cf0e50
function: 0000000000cf0df0
does anyone know how I can perform a function with load() and collect their return?
I also wanted to know how I do to collect a variable using a string with the same name as the variable in load(), I tried to do this:
hello = "Hello World"
print(load("hello"))
but he gives this error:
nil [string "hello"]:1: syntax error near <eof>
would anyone know how i can do this wonder? thanks for your attention !