Example #1
0
int main(int argc, char **argv)
{
	lua_State *vm = luaL_newstate();
	luaL_openlibs(vm);
	luxopen_array(vm);

	luaL_dofile(vm, "test2.lua");
	lux_stackdump(vm);
	lua_close(vm);
}
Example #2
0
signed Lux_Init()
{
	// Register C arrays

	luxopen_array(State);

	// Register XML class

	lua_register(State, "XML", loadxml);

	// Create global SDL event variable

	lux_Index<SDL_Event>::open(State);
	lux_Index<SDL_Event>::get["next"] = next;
	lux_getter(SDL_Event, type);
	#define param(name) lux_Index<SDL_Event>::pseudo<SDL_##name>(#name)
	param(QUIT);
	param(WINDOWEVENT);
	param(KEYDOWN);
	param(KEYUP);
	param(MOUSEMOTION);
	param(MOUSEBUTTONDOWN);
	param(MOUSEBUTTONUP);
	param(MOUSEWHEEL);
	param(DROPFILE);
	param(PRESSED);
	param(RELEASED);
	Event = new (State) SDL_Event;
	if (!Event)
	{
	 return SDL_SetError("out of memory");
	}
	luaL_setmetatable(State, lux_Index<SDL_Event>::Type::name);
	lua_setglobal(State, "event");

	// Done

	return 0;
}