The render.* function can only be called from a .render_script file. If you want access to render.get_window_width() you need to store that value in a Lua module (or a global variable). The same rule applies to go.* (.script files) and gui.* (.gui_script files).
Maybe an old thread, but are there any good examples how to do this? I just want to get the width and height setting to place stuff on the screen. Can’t understand it’s this hard? (Don’t know how to include a render script, or work with Lua modules either, so this answer doen’t help me much )
You can find the default.render_script file under builtins/render. To modify it, make a copy elsewhere and make changes to that.
You also need to make a copy of the default.render file you’ll find with it. Point the copy of the default.render file towards your new render_script file and then engine towards the render file in your game.project file (it’s under “Bootstrap”).
As for lua modules, read up on them here. It feels like they are an answer to half the problems posted here =D
Haha thanks anyway But, yeah I guess I should read more about Lua modules. But don’t use Defold as my main engine, so just want to do quick stuff and itterate fast (read bad code, but that works, but does not scale)