Jump to content

Recommended Posts

Posted

I want to handle the event like in LE2;

 

function object:SetKey(key,value)
if key=="key1" then
self.key1=tonumber(value)
else
return self.super:SetKey(key,value)
end
return 1

end

 

...or does LE3 handle it in a different way?

Posted

No, you can set anything you want (has to be text I think though).

 

entity:SetKeyValue("age", "10")

 

entity:SetKeyValue("eye.color", "blue")

 

etc

Posted

Probably best to use Entity::SetString and GetString(). This will attach values to the Lua script object, if a script is present. They GetKey/SetKey functionality was just left in for backwards compatibility.

Let's build cool stuff and have fun. :)

Posted

Can SetString() be handled in the script so when a value changes I can execute some code? ...rather than checking for the changed value in UpdateWorld() - like LE2 handled SetKey()...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...