Game Development Reference
In-Depth Information
luaL_getmetatable(luaVM, LUA_VECTOR3_METATABLE);
lua_setmetatable(luaVM, -2);
return 1;
}
Whenever a vector is created in Lua, memory is allocated from lua_newuserdata and
the vector metatable is retrieved from Lua and assigned to the userdata. This allows Lua
to know what type of userdata it is dealing with and what functions are supported on the
userdata.
Search WWH ::




Custom Search