/apps/twnlua: don't use module tables
This commit is contained in:
parent
8d67e44009
commit
b6ca9bedb4
@ -164,15 +164,10 @@ print('\n'.join(bindings))
|
|||||||
|
|
||||||
|
|
||||||
loader = "void bindgen_load_%s(lua_State *L) {\n" % api["name"]
|
loader = "void bindgen_load_%s(lua_State *L) {\n" % api["name"]
|
||||||
modules = set(api["procedures"][procedure]["module"] for procedure in api["procedures"])
|
loader += " bindgen_init();\n"
|
||||||
for module in modules:
|
for procedure, procedure_desc in api["procedures"].items():
|
||||||
loader += " bindgen_init();\n"
|
|
||||||
loader += " lua_createtable(L, 0, %i);\n" % len(api["procedures"])
|
|
||||||
for procedure, procedure_desc in api["procedures"].items():
|
|
||||||
if procedure_desc["module"] == module:
|
|
||||||
loader += " lua_pushcfunction(L, binding_%s);\n" % procedure
|
loader += " lua_pushcfunction(L, binding_%s);\n" % procedure
|
||||||
loader += " lua_setfield(L, -2, \"%s\");\n" % procedure_desc["symbol"]
|
loader += " lua_setglobal(L, \"%s\");\n" % procedure
|
||||||
loader += " lua_setglobal(L, \"%s\");\n" % module
|
|
||||||
|
|
||||||
loader += "}\n"
|
loader += "}\n"
|
||||||
print(loader)
|
print(loader)
|
||||||
|
@ -4,17 +4,17 @@ offset = { x = 0, y = 0 }
|
|||||||
angle = 0
|
angle = 0
|
||||||
|
|
||||||
function game_tick()
|
function game_tick()
|
||||||
input.action {
|
input_action {
|
||||||
name = "press",
|
name = "press",
|
||||||
control = "A"
|
control = "A"
|
||||||
}
|
}
|
||||||
|
|
||||||
draw.rectangle {
|
draw_rectangle {
|
||||||
rect = { x = 0, y = 0, w = 640, h = 360 },
|
rect = { x = 0, y = 0, w = 640, h = 360 },
|
||||||
color = { r = 127, g = 0, b = 127, a = 255 },
|
color = { r = 127, g = 0, b = 127, a = 255 },
|
||||||
}
|
}
|
||||||
|
|
||||||
draw.sprite {
|
draw_sprite {
|
||||||
texture = "/assets/title.png",
|
texture = "/assets/title.png",
|
||||||
rect = {
|
rect = {
|
||||||
x = 320 - (320 / 2),
|
x = 320 - (320 / 2),
|
||||||
@ -24,8 +24,8 @@ function game_tick()
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.action_pressed { name = "press" } then
|
if input_action_pressed { name = "press" } then
|
||||||
draw.text {
|
draw_text {
|
||||||
string = "it never happened",
|
string = "it never happened",
|
||||||
position = offset,
|
position = offset,
|
||||||
font = "/fonts/kenney-pixel.ttf",
|
font = "/fonts/kenney-pixel.ttf",
|
||||||
|
Loading…
Reference in New Issue
Block a user