Lua Module

BlitzMax Forums/BlitzMax Programming/Lua Module

Hmm, how would I call a table's function? I'm guessing I have to push a string and get a table then do what said above or something, but I can't work out how to do it :S

the table is 'test', the function is 'oob'

The Lua.
test = {}

function test.oob()
    print("you tested")
end


The BMax.
lua_pushstring( state, "test.oob" )
lua_gettable( state, LUA_GLOBALSINDEX )
Local err:Int = lua_pcall( state, 0, 0, 0)
If err <> 0 Then Print "Error!"


I tried to figure it out myself and so tried the below code, but PANIC: etc.
lua_pushstring( state, "test" )
lua_gettable( state, LUA_GLOBALSINDEX )
lua_pushstring( state, "oob" )
lua_gettable( state, -1 )
Local err:Int = lua_pcall( state, 0, 0, 0)
If err <> 0 Then Print "Error!"


Also:

Does the module have the 'setmetatable' function or do I have to do blitz version of all the functions like that?

I noticed in the mod folder there are lots of c files like the maths lib etc, but I can't use the function in lua, is there a way to enable any of these?