DarthRaff Posted January 17, 2010 Share Posted January 17, 2010 Hi, Can someone, please, put me an example of basic properties table to use in the editor because mine give me errors and i don't know how to solve it. Here is my code: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) end function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("room") group:AddProperty("Classname", PROPERTY_STRING ,"room") group:AddProperty("tipo",PROPERTY_STRING ,"room") group:Expand(1) end give me :"table index is nil" in that line: group:AddProperty("Classname", PROPERTY_STRING ,"room") thankyou. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 17, 2010 Share Posted January 17, 2010 When you are editing an objects lua file, you don't run the file(F5). You must save it. only game scripts can be run. For the basic lua menu just use: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) ) Quote Link to comment Share on other sites More sharing options...
macklebee Posted January 17, 2010 Share Posted January 17, 2010 yes. very true Aggror. I think people are confusing game scripts with scripted properties for an entity. His code above worked just fine, except that the PROPERTY_STRING does not appear to have a default option, so you need to set the default property when you create the class. require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.model:SetKey("Classname","room") object.model:SetKey("tipo","whatever") end function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("room") group:AddProperty("Classname", PROPERTY_STRING ) group:AddProperty("tipo",PROPERTY_STRING ) group:Expand(1) end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
DarthRaff Posted January 17, 2010 Author Share Posted January 17, 2010 Ok, thankyou for the explanation. Your right i'm running the script and not just save. Thankyou very much Aggror and macklebee . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.