Esempio n. 1
0
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.register('getmetatable', get_metatable)
    ls.register('setmetatable', set_metatable)
    ls.load('./lua/vector.luac')
    ls.call(0, 0)
Esempio n. 2
0
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.register('error', error)
    ls.register('pcall', pcall)
    ls.load('./lua/exception.luac')
    ls.call(0, 0)
def main():
    ls = LuaState()

    ls.push_integer(1)
    ls.push_string('2.0')
    ls.push_string('3.0')
    ls.push_number(4.0)
    ls.print_stack()

    ls.arith(ArithOp.ADD)
    ls.print_stack()
    ls.arith(ArithOp.BNOT)
    ls.print_stack()

    ls.len(2)
    ls.print_stack()
    ls.concat(3)
    ls.print_stack()
    ls.push_boolean(ls.compare(1, CmpOp.EQ, 2))
    ls.print_stack()

    ls.push_number(2)
    ls.push_number(2)
    ls.print_stack()
    ls.arith(ArithOp.POW)
    ls.print_stack()

    ls.push_number(3.0)
    ls.push_boolean(ls.compare(4, CmpOp.LT, 5))
    ls.print_stack()

    ls.push_string('hello')
    ls.push_string('world')
    ls.push_boolean(ls.compare(7, CmpOp.LE, 8))
    ls.print_stack()
Esempio n. 4
0
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.register('getmetatable', get_metatable)
    ls.register('setmetatable', set_metatable)
    ls.register('next', lua_next)
    ls.register('pairs', pairs)
    ls.register('ipairs', ipairs)
    ls.load('./lua/iterator.luac')
    ls.call(0, 0)
Esempio n. 5
0
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.register('getmetatable', get_metatable)
    ls.register('setmetatable', set_metatable)
    ls.register('next', lua_next)
    ls.register('pairs', pairs)
    ls.register('ipairs', ipairs)
    ls.register('error', error)
    ls.register('pcall', pcall)

    ls.load(sys.argv[1])
    ls.call(0, 0)
Esempio n. 6
0
def main():
    ls = LuaState()

    ls.push_boolean(True)
    ls.print_stack()
    ls.push_integer(10)
    ls.print_stack()
    ls.push_nil()
    ls.print_stack()
    ls.push_string('hello')
    ls.print_stack()
    ls.push_value(-4)
    ls.print_stack()
    ls.replace(3)
    ls.print_stack()
    ls.set_top(6)
    ls.print_stack()
    ls.remove(-3)
    ls.print_stack()
    ls.set_top(-5)
    ls.print_stack()
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.load('./lua/py_function_call.luac')
    ls.call(0, 0)
def main():
    ls = LuaState()
    ls.load('./lua/function_call.luac')
    ls.call(0, 0)
def main():
    ls = LuaState()
    ls.register('print', py_print)
    ls.load('./lua/closure_upvalue.luac')
    ls.call(0, 0)
Esempio n. 10
0
def main():
    ls = LuaState()
    ls.load('./lua/table.luac')
    ls.call(0, 0)