I'm a noob and trying to do some basic stuff.
My code looks like this:
- Code: Select all
minetest.register_chatcommand("foo1", {
privs = {
interact = true
},
func = function(name, param)
local a = param
end
})
minetest.register_chatcommand("foo2", {
privs = {
interact = true
},
func = function(name, param)
local b = param
end
})
result = a + b
minetest.chat_send_all(result)
I'm trying to do this:
- Code: Select all
local a = 2 -- Set 'a' to 2
local b = 2 -- Set 'b' to 2
local result = a + b -- Set 'result' to a + b, which is 4
a = a + 10
print("Sum is "..result)
Where did I go wrong? It doesn't display a result.
Is there a better way to do this?