lua-users home
lua-l archive

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


> I suggest you start with setting up an alias "egalas" for "==" to see how it works.

Add these lines to luaX_init:

  {
    TString *ts = luaS_new(L, "egalas");
    luaC_fix(L, obj2gco(ts));  /* reserved words are never collected */
    ts->extra = cast_byte(TK_EQ+1-FIRST_RESERVED);  /* reserved word */
  }

Rebuild Lua and try this:

	a=1
	b=3-2
	
	if a egalas b then
		print("ok")
	end

This technique works for all multi-byte tokens but not for single-byte tokens.