awesome/rc.lua
in an interactive iterpreter?I'm trying to create some functions in ~/.config/awesome/rc.lua
for new key bindings. Sometimes I get an error and I want to test these functions by printing the tables and variables in a command line. I downloaded lua5.2
and I started playing with the interactive interpreter. I wrote a small script that I run at the beginning of the interactive mode.
I'm having a problem when I require("gears")
and require("awful")
and pretty much every other library found in /usr/share/awesome/lib/
. Here are some examples:
require("gears")
, I get the error:
/usr/share/awesome/lib/gears/wallpaper.lua:17: attempt to index global 'screen' (a nil value)
require("gears")
, the line require("awful")
, gives me:
/usr/share/awesome/lib/awful/tag.lua:603: attempt to index field 'client' (a nil value)
It seems that for every module in the awesome library, There is some component not known for the lua interpreter. How do I tell the lua interpreter to be aware of these components?
I'm not very experienced with lua coding. Am I digging in the wrong place? Is there a different and perhaps better way to test functions from awesome/rc.lua
?
Mod4 + x
runs a Lua interpreter.
rc.lua
and the various Lua lib files are loaded into an environment provided by the host program (written in C). This is why you have access to the provided API elements like screen
and client
. See the (partially) responsible file here.
If you're just looking to debug some basic Lua functions in the config file, you could consider simply writing to a file or pipe, rather than stdout, and monitoring that instead.
Mod4 + Control + r
restarts Awesome, and reloads the config file.