mirror of
https://github.com/mt-mods/home_workshop_modpack.git
synced 2025-07-01 07:50:39 +02:00
add lua sandbox, tabs, stuff
This commit is contained in:
7
computers/commands/expr/conf.json
Normal file
7
computers/commands/expr/conf.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "expr",
|
||||
"license": "MIT",
|
||||
"version": 0.1,
|
||||
"engine": 0.42,
|
||||
"help": "exicutes mathmatical expresions"
|
||||
}
|
14
computers/commands/expr/init.lua
Normal file
14
computers/commands/expr/init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
function expr(pos, input, data)
|
||||
local output
|
||||
local func = computers.sandbox.loadstring("return " .. input, {env={}})
|
||||
|
||||
if func then output = func() end
|
||||
|
||||
if type(output) ~= "number" or output == nil then
|
||||
return "Error: invalid or missing input"
|
||||
end
|
||||
|
||||
return tostring(output)
|
||||
end
|
||||
|
||||
return expr
|
Reference in New Issue
Block a user