Skip to content

Instantly share code, notes, and snippets.

@triplefox
Created February 22, 2015 08:47
Show Gist options
  • Save triplefox/3c263d2a11e2deed0445 to your computer and use it in GitHub Desktop.
Save triplefox/3c263d2a11e2deed0445 to your computer and use it in GitHub Desktop.
luastate.register("matchEntity", proc (state : PState):cint {.cdecl.} =
var i1 = (state.tointeger(-1)); state.pop(1)
var i0 = (state.tointeger(-1)); state.pop(1)
if not game.matchtile:
let arch0 = game.entity[game.matcha].d[0]
let arch1 = game.entity[game.matchb].d[0]
if (arch0 == i0 and arch1 == i1):
state.pushboolean(cint(true))
elif (arch0 == i1 and arch1 == i0):
swap(game.matcha, game.matchb)
state.pushboolean(cint(true))
else:
state.pushboolean(cint(false))
else:
state.pushboolean(cint(false))
return 1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment