Skip to content

error lupa.lua54.LuaSyntaxError: #260

Closed as not planned
Closed as not planned
@ghost

Description

C:\Users\Ирбис>python ide.py
Version Lua(5.3 or 5.4):
Sorry, by default Lua 5.4
Using Lua 5.4 (compiled with (5, 4))
All commands:

  1. console - terminal lua
  2. run - run code
  3. exit - exit runner Lua
>>>console
>>>function a()
Traceback (most recent call last):
  File "C:\Users\Ирбис\ide.py", line 30, in <module>
    console()
  File "C:\Users\Ирбис\ide.py", line 7, in console
    lua_copy = lua.eval(console_input)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "lupa\lua54.pyx", line 404, in lupa.lua54.LuaRuntime.eval
  File "lupa\lua54.pyx", line 1735, in lupa.lua54.run_lua
lupa.lua54.LuaSyntaxError: error loading code: [string "<python>"]:1: '(' expected near 'a'
def console():
    from lupa import LuaRuntime
    lua = LuaRuntime(unpack_returned_tuples=True)
    while True:
        console_input = input('>>>')
        lua_copy = lua.eval(console_input)

def run():
    from lupa import LuaRuntime
    file = input('Directory file: ')
    f = open(file, 'r')
    code = f.read()
    lua = LuaRuntime(unpack_returned_tuples=True)
    lua_func = lua.eval(code)

version = input('Version Lua(5.3 or 5.4): ')
if version == '5.3':
    import lupa.lua53 as lupa
elif version == '5.4':
    import lupa.lua54 as lupa
else:
    print('Sorry, by default Lua 5.4')
    import lupa
print(f"Using {lupa.LuaRuntime().lua_implementation} (compiled with {lupa.LUA_VERSION})")
print('All commands:\n1. console - terminal lua\n2. run - run code\n3. exit - exit runner Lua ')
while True:
    command = input('>>>')
    if command == 'console':
        console()
    elif command == 'run':
        run() 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions