View Full Version : Draft for LUA Expression Conditional Plugin

April 19th, 2006, 09:56 AM

inspired from honnt's variable conditional, I want to make a similar plugin: A LUA conditional, where simple lua expressions deliver the true/false values. examples:

(a < 25)
(b == "kjhkhlk")
(c == (s+4) and (d > 17))

I do not know anything about treescript. But analysing the things from honnt, I see that this seemns not to be very complicated. Sofar I request a little guide trough this.

Waht I saw till now:
1. I have to get a unique plugin-ID
2. I have to design a DUI xml-file with the designer with a simple imput mask for the LUA expression string
3. I have to create a lua script file to be placed in the treescript directory which contains the functions to be executed when my condition is appied.

Is this correct sofar? Anything missing?
I would appreciate to get some more detailed infos what the most important requirements are ...

Thanks for help in advance,


April 20th, 2006, 07:26 PM
ok guys. Because of my impatience - as always - I got trough this on my bloody knees. I found some things in the online reference manual and I analysed existing examples and got an solution.

With this conditional plugin named "LUA Conditional" you can make conditionals by referring any logical LUA expression. For those who needs something like this. Keep in mind, that the used LUA code has to return true or false! I didn't spent to much time in error handling :wink: . The LUA console will help you debugging wrong expressions.

Any comments? I am not sure, if this way of conditional is very efficient. But it works in my existing gml which is really heavy.

April 27th, 2006, 01:46 PM
I have tested this lua expression conditional and I find it well. Should I upload it to the download list?

April 27th, 2006, 01:50 PM
mhund, I plagiarized your lua variable conditional and included it my overall "variable conditional"....works well. I can either update my entry or you can go ahead and make it a separate download.... your call.