コード例 #1
0
ファイル: g_trigger.c プロジェクト: otty/cake3
void trigger_push_touch(gentity_t * self, gentity_t * other, trace_t * trace)
{
	if(!other->client)
	{
		return;
	}
	
#ifdef LUA
	G_RunLuaFunction(self->luaTouch, "ee>", self, other);
#endif

	BG_TouchJumpPad(&other->client->ps, &self->s);
}
コード例 #2
0
ファイル: g_lua.cpp プロジェクト: OnlyTheGhosts/OWEngine
/*
============
G_InitLua
============
*/
void G_InitLua()
{
	char            buf[MAX_STRING_CHARS];
	
	G_Printf( "------- Game Lua Initialization -------\n" );
	
	g_luaState = lua_open();
	
	// Lua standard lib
	luaopen_base( g_luaState );
	luaopen_string( g_luaState );
	
	// Quake lib
	luaopen_entity( g_luaState );
	luaopen_game( g_luaState );
	luaopen_qmath( g_luaState );
	luaopen_vector( g_luaState );
	
	// Create the callback table (at location 1 in the registry)
	lua_pushnumber( g_luaState, 1 );
	lua_newtable( g_luaState );
	lua_settable( g_luaState, LUA_REGISTRYINDEX );
	
	// load global scripts
	G_Printf( "global lua scripts:\n" );
	G_InitLua_Global();
	
	// load map-specific lua scripts
	G_Printf( "map specific lua scripts:\n" );
	g_cvars->Cvar_VariableStringBuffer( "mapname", buf, sizeof( buf ) );
	G_InitLua_Local( buf );
	G_LoadLuaScript( va( "maps/%s.lua", buf ) );
	
	G_Printf( "-----------------------------------\n" );
	
	G_RunLuaFunction( g_luaState, "G_InitGame", "" );
	
}