/apps/twnlua: actually use 32 bit
This commit is contained in:
parent
85d7d54eed
commit
3bf8d7bedb
@ -30,7 +30,7 @@ add_custom_target(
|
|||||||
DEPENDS ${TWN_OUT_DIR}/data/scripts/twnapi.lua
|
DEPENDS ${TWN_OUT_DIR}/data/scripts/twnapi.lua
|
||||||
)
|
)
|
||||||
|
|
||||||
add_compile_definitions(LUA_32BITS)
|
add_compile_definitions(LUA_32BITS=1)
|
||||||
|
|
||||||
set(SOURCE_FILES
|
set(SOURCE_FILES
|
||||||
game.c
|
game.c
|
||||||
|
@ -36,7 +36,7 @@ def to_table(typedesc, variable, indent = 0):
|
|||||||
binding = ' ' * indent + "lua_createtable(L, 0, %i);\n" % len(typedesc["fields"])
|
binding = ' ' * indent + "lua_createtable(L, 0, %i);\n" % len(typedesc["fields"])
|
||||||
for field in typedesc["fields"]:
|
for field in typedesc["fields"]:
|
||||||
if field["type"] == "float" or field["type"] == "uint8_t":
|
if field["type"] == "float" or field["type"] == "uint8_t":
|
||||||
binding += ' ' * indent + "lua_pushnumber(L, (double)(%s));\n" % (variable + ".%s" % field["name"])
|
binding += ' ' * indent + "lua_pushnumber(L, (float)(%s));\n" % (variable + ".%s" % field["name"])
|
||||||
elif field["type"] == "bool":
|
elif field["type"] == "bool":
|
||||||
binding += ' ' * indent + "lua_pushboolean(L, (%s));\n" % (variable + ".%s" % field["name"])
|
binding += ' ' * indent + "lua_pushboolean(L, (%s));\n" % (variable + ".%s" % field["name"])
|
||||||
elif field["type"] in api["types"]:
|
elif field["type"] in api["types"]:
|
||||||
@ -109,7 +109,7 @@ for procedure, procedure_desc in api["procedures"].items():
|
|||||||
if procedure_desc["return"] == "bool":
|
if procedure_desc["return"] == "bool":
|
||||||
binding += " lua_pushboolean(L, (int)(%s(%s)));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
binding += " lua_pushboolean(L, (int)(%s(%s)));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
||||||
elif procedure_desc["return"] == "float":
|
elif procedure_desc["return"] == "float":
|
||||||
binding += " lua_pushnumber(L, (double)(%s(%s)));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
binding += " lua_pushnumber(L, (float)(%s(%s)));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
||||||
elif procedure_desc["return"] == "char *":
|
elif procedure_desc["return"] == "char *":
|
||||||
binding += " lua_pushstring(L, %s(%s));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
binding += " lua_pushstring(L, %s(%s));\n" % (procedure, ", ".join(param["name"] for param in procedure_desc["params"]))
|
||||||
elif type(procedure_desc["return"]) is dict or procedure_desc["return"] in api["types"]:
|
elif type(procedure_desc["return"]) is dict or procedure_desc["return"] in api["types"]:
|
||||||
|
@ -210,8 +210,9 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
|
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
|
||||||
*/
|
*/
|
||||||
|
#if !defined(LUA_32BITS)
|
||||||
#define LUA_32BITS 0
|
#define LUA_32BITS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
|
@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
|
||||||
|
Loading…
Reference in New Issue
Block a user