* Call a Lua function */
| 952 | * Call a Lua function |
| 953 | */ |
| 954 | bool CallFunction(lua_State *L, int32 NumArgs, int32 NumResults) |
| 955 | { |
| 956 | int32 ErrorReporterIdx = lua_gettop(L) - NumArgs - 1; |
| 957 | int32 Code = lua_pcall(L, NumArgs, NumResults, -(NumArgs + 2)); |
| 958 | if (Code == LUA_OK) |
| 959 | { |
| 960 | lua_remove(L, ErrorReporterIdx); |
| 961 | return true; |
| 962 | } |
| 963 | int32 TopIdx = lua_gettop(L); |
| 964 | lua_pop(L, TopIdx - ErrorReporterIdx + 1); |
| 965 | return false; |
| 966 | } |
| 967 | |
| 968 | /** |
| 969 | * Push a field (property or function) |