[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "import"?
- From: erik@... (Erik Hougaard)
- Date: Sun, 1 Oct 2000 11:23:26 +0200
----- Original Message -----
> I would like to reproduce behavior similar to Python's
> "import". Basically, I'd like to import a lua file
> and have everything declared/defined in that file to
> appear in the global table named whatever the module
> is named.
>
> Specifically, I would like to do something like this
> in lua code:
>
> -- somemodule.lua
> --
> v = 1.0;
> t = { a=0, b=1 };
>
> -- somefile.lua
> --
> import("somemodule");
>
> print "v = " .. somemodule.v;
>
dofile("somemodule.lua")
BTW: You dont need the ; at the end of lines :-)
/Erik