Hey everyone, I am implementing Lua script system into my engine, I have added simple functions like:
println
getclientnum
...
fastsqrt
gethostname
.. etc
But I want to make them like:
core.println
server.getclientnum
...
gamemath.fastsqrt
server.gethostname
.. etc
Here's my "RegisterFunction" code, it simply adds function into Lua script. I know lua_setfield, but when I try to use it doesn't work or whatever. I have tried to write "core:println('text')" and like core. ( with dot ).
template<>
void ncLuaScript::RegisterConstant<lua_CFunction>( lua_CFunction value, const char* constantname )
{
lua_pushcclosure( L, value, 0);
lua_setglobal( L, constantname );
}
Could someone help me with this, please? Thanks in advance!