lua-users home
lua-l archive

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


It was thus said that the Great caco once stated:
> I have problems getting package `hsm_statechart` working under Lua 5.4
> (which should support > Lua 5.1). After `luarocks install hsm_statechart`,
> when I load the package it says `luaL_register undefined` which tells me
> it's not updated for Lua 5.4... I've downloaded the source and tried to
> update it, but not successful so far. Anyone using hsm_statechart under
> Lua 5.4 (I'm aware of other statecharts but they are pure lua code and may
> be slower than the C-compiled hsm_statechart module).

  If the code is expecting luaL_register(), then it hasn't even been updated
for Lua 5.2.  I'm looking at the code, and ... it's not straightforward. 
The line:

	luaL_register( L, NULL, hula_member_fun ); 

can be replaced with (for Lua 5.2 or higher):

	luaL_setfuncs(L,hula_member_fun,0);

but the other luaL_register() is problematic.  The replacement function for
that is

	luaL_newlib(L,hlua_class_fun);

but that no longer make a globel entry.  Given that the name of the table is
passed in, leads me to belive that the code assumes a global table exists,
and so the line:

	luaL_register( L, type, hula_class_fun ); 

may have to be replaced with:

	luaL_newlib(L,hlua_class_fun);
	lua_setglobal(L,type);

  -spc