Integrating to script is made by creating lua_CFunction functions and use one of the game-engines builtin helper functions luaM_. One example functions is this:
int playstate::Font_Load(lua_State* L)
{
std::string path = lua_tostring(L, -1); lua_pop(L, 1);
Resource<Font> font = IResourceManager::Get().GetResource<Font>(path);
luaM_pushresource(L, font.GetResourceData());
return 1;
}
As you can see, the logic for handling if parameters are supplied or not, and what to do when that occurs, are up to the called function. This results in a lot of duplicated code. It also increases the risk of bugs.
A solution which is stable and secure is needed for before the final 1.0 release is made.
Integrating to script is made by creating lua_CFunction functions and use one of the game-engines builtin helper functions luaM_. One example functions is this:
As you can see, the logic for handling if parameters are supplied or not, and what to do when that occurs, are up to the called function. This results in a lot of duplicated code. It also increases the risk of bugs.
A solution which is stable and secure is needed for before the final 1.0 release is made.