I may seem like a complete newbie when I ask this, but I used to play a game called Roblox which involved a simpler version of Lua scripting, which used mainly functions, and events that connected to the functions. Like, a script would be inserted into a brick, and would change color when touched like so:
function onTouched(hit)
script.Parent.BrickColor = BrickColor.new((math.random(1,255)))
wait(1)
end
script.Parent.Touched:connect(onTouched)
Roblox said that their version of Lua was heavily simplified since it's audience is mostly children, but would a script like that even do anything in Cafu? I have more examples if needed.
Is Lua different here?
"Many men who live deserve death, and many men who are dead, deserve life."
Re: Is Lua different here?
Well, Lua is an extensible, embedded language, and I guess each project uses it in a different, project-specific way.Viggsy wrote:Roblox said that their version of Lua was heavily simplified since it's audience is mostly children, but would a script like that even do anything in Cafu?
In Cafu, the key idea is that the relevant "objects", i.e. the windows in a GUI or the entities in a map, are made available to the script.
The Cafu engine then calls the script as a whole, or specific script-defined functions ("methods") of the objects, e.g. when an event occurs.
Please see thread http://www.cafu.de/forum/viewtopic.php?f=8&t=730, where I've posted some details about documentation (which unfortunately is still sparse) and examples.
Best regards,
Carsten
Carsten
Who is online
Users browsing this forum: No registered users and 128 guests