59 lines
950 B
Plaintext
59 lines
950 B
Plaintext
Notes
|
|
|
|
# Lua API integration
|
|
|
|
• Easy way: global namespace
|
|
|
|
## GUI
|
|
```lua
|
|
local gui = LuaGUI.new("test_gui")
|
|
|
|
local button = gui:button {
|
|
name = "hello_btn",
|
|
pos = {x = 8, y = 2},
|
|
label = "Hello",
|
|
}
|
|
|
|
button.on_click = function(self)
|
|
print("lol")
|
|
end
|
|
|
|
local inv = openminer:player():inventory()
|
|
gui:inventory {
|
|
name = "main_inv",
|
|
pos = {x = 8, y = 12}
|
|
player = openminer:player():name()
|
|
inventory = "main",
|
|
size = {x = 8, y = 3},
|
|
offset = 0,
|
|
}
|
|
|
|
gui:show()
|
|
```
|
|
## HUD
|
|
```lua
|
|
local hud = openminer:player():hud()
|
|
```
|
|
## Player inventory
|
|
|
|
• `openminer:player():inventory()`
|
|
• `openminer:player():inventory():add_stack(name, count=1)`
|
|
|
|
## World
|
|
|
|
• `openminer:get_block(pos)`
|
|
• `openminer:get_meta(pos)`
|
|
• `openminer:get_inventory(pos)`
|
|
|
|
* * *
|
|
|
|
# Old notes
|
|
|
|
• GUI Texture:
|
|
|
|
• Button: 200x20 (0;46, 0;66, 0;86)
|
|
• Hotbar: 182x22
|
|
• Selection: 24x24 (0;22)
|
|
|
|
> vim:ft=notes
|