Ulysses

General => Off-Topic => Topic started by: LuaTenshi on January 23, 2014, 05:11:34 PM

Title: How would I change my current environment in lua?
Post by: LuaTenshi on January 23, 2014, 05:11:34 PM
So when I was working on this...

http://forums.ulyssesmod.net/index.php/topic,6987.msg34775.html#msg34775 (http://forums.ulyssesmod.net/index.php/topic,6987.msg34775.html#msg34775)

I got a message saying this...

Quote
dont do it on g
do it on the current environment
make a new environment

So how exactly would I even start doing that, I am currently pretty tired so sorry if I am just being stupid but I have checked all of the following sites, and I am still not sure how to do it.

http://www.lua.org/pil/14.3.html (http://www.lua.org/pil/14.3.html)
http://stackoverflow.com/questions/14290527/recreating-setfenv-in-lua-5-2 (http://stackoverflow.com/questions/14290527/recreating-setfenv-in-lua-5-2)
Title: Re: How would I change my current environment in lua?
Post by: Megiddo on January 23, 2014, 05:23:44 PM
Any table is its own environment. This person is just saying to do it on a table. E.G., do plys, then you can go plys.Megiddo (or whatever).
Title: Re: How would I change my current environment in lua?
Post by: LuaTenshi on January 23, 2014, 09:01:37 PM
Any table is its own environment. This person is just saying to do it on a table. E.G., do plys, then you can go plys.Megiddo (or whatever).

Tbanks, I wish that this information was easier to get... :\
Title: Re: How would I change my current environment in lua?
Post by: Megiddo on January 24, 2014, 05:15:45 AM
It's right there in the manual (http://www.lua.org/manual/5.2/manual.html#2.2). ;)