Hey guys. I decided to try and implement Lua in my little framework but frankly I have no ideea where to start and all the searches I made didn't help either.
I've read somewhere that it's better to have a single virtual machine.
Basically look at this example:
'BMax code
Type TEntity
Field x:float
Field y:float
Field speed:float
Field direction:float
Method Update()
'Move The Entity with Lua
End Method
End Type
global entList:TList = CreateList()
for local i:int = 0 to 99
ent:TEntity = new TEntity
entList.AddLast(ent)
next
while not appterminate()
for local ent:TEntity = eachin entList
ent.Update()
next
wend
'Lua Code
function OnUpdate()
x=x+cos(direction)*speed
y=y+sin(direction)*speed
end
Could anyone complete it a bit to get it running?
Basically I want to just have the possibility to add scripts on different events that I can just assign.
|