lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



In that case, luac saves the (invisible) main chunk of the file test.lua. Which is a function that has your "state=" line as its contents.

Luac does not save runtime generated values.

-asko


Markus Heukelom kirjoitti 22.10.2007 kello 15:39:


luac does not save the lua_State: it saves functions.


Sorry, I didn't mean the saving the lua_State, but just Lua value(s).

If luac saves functions, then what happens if I do this:

test.lua:

state = {test = "value"}


luac -o test.luac test.lua

lua
dofile("test.luac")
print(state.test)
value

Obviously, state is not a function, but luac does save it, right? Does it save _G as a function (closure) or something? (I looked a bit a the output
of luac -l test.luac)

Thanks.

Markus Heukelom