internal object getObject(IntPtr luaState,int index)
{
LuaTypes type=LuaDLL.lua_type(luaState,index);
switch(type)
{
case LuaTypes.LUA_TNUMBER:
{
return LuaDLL.lua_tonumber(luaState,index);
}
case LuaTypes.LUA_TSTRING:
{
return LuaDLL.lua_tostring(luaState,index);
}
case LuaTypes.LUA_TBOOLEAN:
{
return LuaDLL.lua_toboolean(luaState,index);
}
case LuaTypes.LUA_TTABLE:
{
return getTable(luaState,index);
}
case LuaTypes.LUA_TFUNCTION:
{
return getFunction(luaState,index);
}
case LuaTypes.LUA_TUSERDATA:
{
int udata=LuaDLL.luanet_tonetobject(luaState,index);
if(udata!=-1)
return objects[udata];
else
return getUserData(luaState,index);
}
default:
return null;
}
}