Hi all, I'm a super new to Love (and to Lua in general). This is probably a super-simple issue and I'm just missing something obvious, but I can't figure it out even though I've searched the forum and Google quite a bit.
I'm generating heightmaps using the Lua diamond-square heightmap generator found at https://github.com/mlepage/heightmap. I load it in main.lua using heightmap = require "heightmap" on the first line of function love.load() . I can get output from it just fine, but I want to be able to re-create the same heightmaps, so I need to seed a deterministic function, rather than the random() function (line 92 of https://github.com/mlepage/heightmap/bl ... ghtmap.lua). I'm seeding with 2 integers (Seed & ID, which are global variables), so I changed line 92 to read:
Code: Select all
return h + (love.math.noise(x,y,Seed,ID)-0.5)*d
Code: Select all
Error: heightmap.lua:92: attempt to index global 'love' (a nil value)
stack traceback:
heightmap.lua:92: in function 'f'
heightmap.lua:60: in function 'diamondsquare'
heightmap.lua:100: in function 'create'
main.lua:19: in function 'load'
[string "boot.lua"]:440: in function <[string "boot.lua"]:436>
[C]: in function 'xpcall'
>Exit code: 1
Code: Select all
function defaultf(map, x, y, d, h)
--return h + (random()-0.5)*d
print(x)
print(y)
print(Seed)
print(ID)
return h + (love.math.noise(x,y,Seed,ID)-0.5)*d
end
Code: Select all
Error: heightmap.lua:128: attempt to call global 'print' (a nil value)
stack traceback:
heightmap.lua:128: in function 'f'
heightmap.lua:95: in function 'diamondsquare'
heightmap.lua:140: in function 'create'
main.lua:19: in function 'load'
[string "boot.lua"]:440: in function <[string "boot.lua"]:436>
[C]: in function 'xpcall'
>Exit code: 1
Go ahead and have a good laugh at this newbie, but when you catch your breath can someone tell me why the basic love functions are failing?