Skip to content

Commit

Permalink
Update: run lua tools
Browse files Browse the repository at this point in the history
  • Loading branch information
i0gan committed Sep 23, 2024
1 parent 64ff5d5 commit ef94542
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions script/run_lua.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /bin/python
import requests
import json

Expand All @@ -15,19 +16,48 @@
Env
ModuleMgr
'''

print(global_env)
print('Example: print_t(Env)')
example1='''
Example 1: print env info
print_t(Env)
:r
'''
print(example1)

example2='''
Example2: print the config data
local ta = Squick:GetConfig(Excel.Scene.ThisName)
return print_t(ta)
:r
'''
print(example2)

print("input :r to run")
print("input :q to quit")

def check_input(user_input):
real_inpurt = ''
if 'return' not in user_input:
real_input = 'return ' + user_input
else:
real_input = user_input
return real_input


while True:
user_input = input("lua: ")
data['script'] = check_input(user_input)
script = ""
while True:
user_input = input()
if user_input == ':r':
break
if user_input == ':q':
exit()
script += user_input + '\n'
print(script)
data['script'] = check_input(script)
#print(user_input)
response = requests.post(url, data=json.dumps(data))
output = json.loads(response.text)
Expand Down

0 comments on commit ef94542

Please sign in to comment.