summaryrefslogtreecommitdiff
path: root/src/script/common/c_converter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/common/c_converter.cpp')
-rw-r--r--src/script/common/c_converter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp
index e5d89dea9..8f88aeb60 100644
--- a/src/script/common/c_converter.cpp
+++ b/src/script/common/c_converter.cpp
@@ -427,6 +427,19 @@ bool getintfield(lua_State *L, int table,
}
bool getintfield(lua_State *L, int table,
+ const char *fieldname, s8 &result)
+{
+ lua_getfield(L, table, fieldname);
+ bool got = false;
+ if (lua_isnumber(L, -1)) {
+ result = lua_tointeger(L, -1);
+ got = true;
+ }
+ lua_pop(L, 1);
+ return got;
+}
+
+bool getintfield(lua_State *L, int table,
const char *fieldname, u16 &result)
{
lua_getfield(L, table, fieldname);