Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
462 B
3
Indexable
// luascript.cpp
int32_t LuaInterface::luaGetPlayerByName(lua_State* L)
{
	//getPlayerByName(name)
	ScriptEnviroment* env = getEnv();
	if(Player* player = g_game.getPlayerByName(popString(L)))
		lua_pushnumber(L, env->addThing(player));
	else
		lua_pushnil(L);

	return 1;
}

//getPlayerByName(name)
lua_register(m_luaState, "getPlayerByName", LuaInterface::luaGetPlayerByName);


// luascript.h
static int32_t luaGetPlayerByName(lua_State* L);