Open main menu
Posts
Gists
Guilds
Users
Decipher
Docs
Open user menu
Log in
Sign up
Create a new gist
Posts
Gists
Guilds
Users
Decipher
Docs
Files
prepend.src
append.src
igs.src
prepend.src
get_scope = function()
scope = {}
scope.map = map
scope.list = list
scope.number = number
scope.string = string
scope.globals = globals
return scope
end function
shallow_copy = function(obj1, obj2)
for i in obj2.indexes
obj1[@i] = @obj2[@i]
end for
end function
transfer_scope = function(scope)
shallow_copy(map, scope.map)
shallow_copy(list, scope.list)
shallow_copy(number, scope.number)
shallow_copy(string, scope.string)
shallow_copy(globals, scope.globals)
end function
parent_scope = get_custom_object.parent_scope
transfer_scope(parent_scope)
append.src
get_custom_object.child_scope = get_scope
igs.src
get_scope = function()
scope = {}
scope.map = map
scope.list = list
scope.number = number
scope.string = string
scope.globals = globals
return scope
end function
shallow_copy = function(obj1, obj2)
for i in obj2.indexes
obj1[@i] = @obj2[@i]
end for
end function
transfer_scope = function(scope)
shallow_copy(map, scope.map)
shallow_copy(list, scope.list)
shallow_copy(number, scope.number)
shallow_copy(string, scope.string)
shallow_copy(globals, scope.globals)
end function
a = "hello"
eval = function(code)
comp = get_shell.host_computer
PREPEND_CODE = comp.File("/home/me/projects/igs/prepend.src").get_content
APPEND_CODE = comp.File("/home/me/projects/igs/append.src").get_content
EVAL_BUILD_PATH = "/home/me/evals"
EVAL_SCRIPT_NAME = "evalScript.src"
eval_script_code = PREPEND_CODE + char(10) + code + char(10) + APPEND_CODE
eval_script = comp.File(EVAL_BUILD_PATH + "/" + EVAL_SCRIPT_NAME)
if eval_script != null then
eval_script.delete
end if
comp.touch(EVAL_BUILD_PATH, EVAL_SCRIPT_NAME)
eval_script = comp.File(EVAL_BUILD_PATH + "/" + EVAL_SCRIPT_NAME)
eval_script.set_content(eval_script_code)
get_shell.build(EVAL_BUILD_PATH + "/" + EVAL_SCRIPT_NAME, EVAL_BUILD_PATH)
get_custom_object.parent_scope = get_scope
get_shell.launch(EVAL_BUILD_PATH + "/" + EVAL_SCRIPT_NAME.split(".")[0])
transfer_scope(get_custom_object.child_scope)
end function
while true
arbitrary_code = user_input("igs> ")
eval(arbitrary_code)
end while