Some questions on Lua

BlitzMax Forums/BlitzMax Programming/Some questions on Lua

Sanctus(Posted 2010) [#1]
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.


Zeke(Posted 2010) [#2]
check this http://www.blitzbasic.com/Community/posts.php?topic=85952 and also Noel's great Lugi module.


Sanctus(Posted 2010) [#3]
Thank you. I looked into it and I will try those things myself when I have a bit of time.