mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'lua-allow-player' into 'master'
Allow access to players userdata outside levels. See merge request STJr/SRB2Internal!386
This commit is contained in:
commit
faf61912a6
2 changed files with 4 additions and 2 deletions
|
@ -164,6 +164,8 @@ static int mobj_get(lua_State *L)
|
||||||
enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt);
|
enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt);
|
||||||
lua_settop(L, 2);
|
lua_settop(L, 2);
|
||||||
|
|
||||||
|
INLEVEL
|
||||||
|
|
||||||
if (!mo) {
|
if (!mo) {
|
||||||
if (field == mobj_valid) {
|
if (field == mobj_valid) {
|
||||||
lua_pushboolean(L, 0);
|
lua_pushboolean(L, 0);
|
||||||
|
@ -409,6 +411,8 @@ static int mobj_set(lua_State *L)
|
||||||
enum mobj_e field = Lua_optoption(L, 2, mobj_opt[0], mobj_opt);
|
enum mobj_e field = Lua_optoption(L, 2, mobj_opt[0], mobj_opt);
|
||||||
lua_settop(L, 3);
|
lua_settop(L, 3);
|
||||||
|
|
||||||
|
INLEVEL
|
||||||
|
|
||||||
if (!mo)
|
if (!mo)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
static int lib_iteratePlayers(lua_State *L)
|
static int lib_iteratePlayers(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 i = -1;
|
INT32 i = -1;
|
||||||
INLEVEL
|
|
||||||
if (lua_gettop(L) < 2)
|
if (lua_gettop(L) < 2)
|
||||||
{
|
{
|
||||||
//return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do <block> end'.");
|
//return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do <block> end'.");
|
||||||
|
@ -52,7 +51,6 @@ static int lib_getPlayer(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *field;
|
const char *field;
|
||||||
// i -> players[i]
|
// i -> players[i]
|
||||||
INLEVEL
|
|
||||||
if (lua_type(L, 2) == LUA_TNUMBER)
|
if (lua_type(L, 2) == LUA_TNUMBER)
|
||||||
{
|
{
|
||||||
lua_Integer i = luaL_checkinteger(L, 2);
|
lua_Integer i = luaL_checkinteger(L, 2);
|
||||||
|
|
Loading…
Reference in a new issue