Skip to main content

init

Function init 

Source
pub fn init(state: &mut LuaState) -> Result<(), LuaError>
Expand description

Initialise the lexer subsystem: intern all reserved words and fix them in the GC so they are never collected.

Must be called exactly once during VM startup via luaX_init.

ยงC source


//   int i;
//   TString *e = luaS_newliteral(L, LUA_ENV);  /* create env name */
//   luaC_fix(L, obj2gco(e));  /* never collect this name */
//   for (i=0; i<NUM_RESERVED; i++) {
//     TString *ts = luaS_new(L, luaX_tokens[i]);
//     luaC_fix(L, obj2gco(ts));  /* reserved words are never collected */
//     ts->extra = cast_byte(i+1);  /* reserved word */
//   }
// }