lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi I've been bending my head around this for a few days and I think its time for me to swallow my pride. I'm using lua 5.0 and am running a script that is being used to set up some configs in my application as well as define a transformation function. The transformation function depends on the math and base libs, but as soon as I add luaopen_base( luaVM ); or luaopen_math( luaVM ); to my application code the globals return the wrong values (all 0 ).
	
	My globals accessing routine is of the form:

	lua_Number GetGlobalNumber( lua_State* luaVM, char* name ) {
		lua_Number result;
		lua_pushstring( luaVM, name );
		lua_gettable( luaVM, LUA_GLOBALSINDEX );
		result = lua_tonumber( luaVM, 1 );
		lua_pop( luaVM, 1 );
		return result;
	}

Am I just being really thick headed? Why does this work if i don't load any libraries? Any help would be greatly appreciated.

don