mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 13:01:49 +00:00
commands results and variables
This commit is contained in:
parent
0a45987811
commit
5b2b89c778
7 changed files with 39 additions and 8 deletions
|
|
@ -1,3 +1,5 @@
|
|||
<container size='400' color='#00000080' size-func="unpack(gui.get_viewport())">
|
||||
<textbox id='prompt' margin='0' gravity='bottom-left' size-func="gui.get_viewport()[1],40"></textbox>
|
||||
<textbox id='log' margin='0' multiline='true' size-func="gui.get_viewport()[1],gui.get_viewport()[2]-40">
|
||||
</textbox>
|
||||
<textbox id='prompt' consumer='submit' margin='0' gravity='bottom-left' size-func="gui.get_viewport()[1],40"></textbox>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
function submit(text)
|
||||
local x,y,z = player.get_pos(0)
|
||||
console.set('pos.x', x)
|
||||
console.set('pos.y', y)
|
||||
console.set('pos.z', z)
|
||||
local status, result = pcall(function() return console.execute(text) end)
|
||||
if result ~= nil then
|
||||
document.log.text = document.log.text..tostring(result)..'\n'
|
||||
end
|
||||
document.prompt.text = ""
|
||||
end
|
||||
|
||||
function on_open()
|
||||
document.prompt.focused = true
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue