コード例 #1
0
ファイル: LuaPlus.cpp プロジェクト: brock7/TianLong
void LuaState::Init( bool initStandardLibrary )
{
	// Register some basic functions with Lua.
	if (initStandardLibrary)
	{
		// A "bug" in Lua 5.01 causes stack entries to be left behind.
		LuaAutoBlock autoBlock(this);
		luaopen_base(m_state);
		luaopen_table( m_state );
		luaopen_io(m_state);
		luaopen_string(m_state);
		luaopen_wstring(m_state);
		luaopen_math(m_state);
		luaopen_debug(m_state);
#ifndef _WIN32_WCE
		luaopen_loadlib(m_state);
#endif _WIN32_WCE

		ScriptFunctionsRegister( this );

		GetGlobals().Register("LuaDumpGlobals", LS_LuaDumpGlobals);
		GetGlobals().Register("LuaDumpObject", LS_LuaDumpObject);
		GetGlobals().Register("LuaDumpFile", LS_LuaDumpFile);
	}

	GetGlobals().Register("LOG", LS_LOG);
	GetGlobals().Register("_ALERT", LS_LOG);

	lua_atpanic( m_state, FatalError );
}
コード例 #2
0
void LuaState::Init( bool initStandardLibrary )
{
#if LUAPLUS_INCLUDE_STANDARD_LIBRARY
	// Register some basic functions with Lua.
	if (initStandardLibrary)
	{
		LuaAutoBlock autoBlock(this);

		lua_cpcall(m_state, &pmain, NULL);

#ifdef LUA_MTSUPPORT
//        luaopen_thread(m_state);
#endif // LUA_MTSUPPORT

		ScriptFunctionsRegister( this );

        GetGlobals().Register("LuaDumpGlobals", LS_LuaDumpGlobals);
		GetGlobals().Register("LuaDumpObject", LS_LuaDumpObject);
		GetGlobals().Register("LuaDumpFile", LS_LuaDumpFile);

		GetGlobals().Register("LOG", LS_LOG);
		GetGlobals().Register("_ALERT", LS_ALERT);
	}
#endif // LUAPLUS_INCLUDE_STANDARD_LIBRARY

	lua_atpanic( m_state, FatalError );
}
コード例 #3
0
ファイル: LuaPlus_Libs.cpp プロジェクト: korman/Temp
void LuaState::OpenLibs()
{
#if LUAPLUS_INCLUDE_STANDARD_LIBRARY
	LuaAutoBlock autoBlock(this);
	lua_cpcall(m_state, &pmain, NULL);

#ifdef LUA_MTSUPPORT
//        luaopen_thread(m_state);
#endif // LUA_MTSUPPORT

	ScriptFunctionsRegister(this);

    GetGlobals().Register("LuaDumpGlobals", LS_LuaDumpGlobals);
	GetGlobals().Register("LuaDumpObject", LS_LuaDumpObject);
	GetGlobals().Register("LuaDumpFile", LS_LuaDumpFile);

	GetGlobals().Register("LOG", LS_LOG);
	GetGlobals().Register("_ALERT", LS_ALERT);
#endif // LUAPLUS_INCLUDE_STANDARD_LIBRARY
}