Hi,
On 17.10.2012 20:18, Manuel Kasser wrote:
[...]
> Unfortunately I haven't found any explanation or example, so I hope
> someone here can help me.
>
> What I tried:
>
> I created a file named "widgetfile.lua", which contains:
>> local awful = require("awful")
>> local vicious = vicious
>> local widget = widget
>> module("widgetfile")
>>
>> function makecpuw()
>> cputxt = widget({type = "textbox"})
>> vicious.register(cputxt, vicious.widgets.cpu, '<span
> color="#9393cc">CPU: $1%</span>', 1)
>> return cputxt
>> end
>
> The relevant part of the rc.lua contains (originally the first two lines
> of the makecpuw-function were located at this point (and it worked well)):
>> cputxt = widgetfile.makecpuw
>
> And a "require("widgetfile")" at the end of the "require"-block.
>
> I would be glad if someone could help me getting this to work (or reveal
> to me that it is technically impossible, which I do not hope).
Well, it would help a lot if you would tell us which error you get. Because your
code looks fine to me.
Also, if you "just" want to move stuff into an external file, use
dofile("widgetfile.lua") instead of require("widgetfile"). Then you can just put
"normal" stuff into widgetfile.lua, everything up to module("widgetfile") is not
required in this case.
However, since this isn't a lua module then, your makecpuw()-function would just
be makecpuw(), not widgetfile.makecpuw().
Cheers,
Uli
--
- He made himself, me nothing, you nothing out of the dust
- Er machte sich mir nichts, dir nichts aus dem Staub
--
To unsubscribe, send mail to [email protected].