Code: Select all
local player = minetest.get_player_by_name("username")
local idx = player:hud_add({
hud_elem_type = "text",
position = {x = 0.5, y = 0.5},
offset = {x = 0, y = 0},
text = "Hello world!",
alignment = {x = 0, y = 0}, -- center aligned
scale = {x = 100, y = 100}, -- covered later
})
Code: Select all
ModError: Failed to load and run script from /home/noah/.minetest/mods/xp/init.lua:
/home/example/.minetest/mods/xp/init.lua:2: attempt to index local 'player' (a nil value)
stack traceback:
/home/example/.minetest/mods/xp/init.lua:2: in main chunk
Siehe debug.txt für Details.