1
print "[lua] This is runme.lua"
2
-- test program for embeded lua
3
-- we do not need to load the library, as it was already in the intrepreter
4
-- but lets check anyway
6
assert(type(example)=='table',"Don't appear to have loaded the example module. Do not run this file directly, run the embed3 executable")
8
print "[lua] looking to see if we have a pointer to the engine"
9
if type(pEngine)=="userdata" then
10
print "[lua] looks good"
12
print "[lua] nope, no signs of it"
16
-- the embed program expects a function void onEvent(Event)
20
print("[Lua] onEvent with event",e.mType)
21
-- lets do something with the Engine
22
-- nothing clever, but ...
23
if e.mType==example.Event_STARTUP then
25
elseif e.mType==example.Event_KEYPRESS then
26
pEngine:accelerate(0.4)
27
elseif e.mType==example.Event_MOUSEPRESS then
28
pEngine:decelerate(0.4)
29
elseif e.mType==example.Event_SHUTDOWN then
32
error("unknown event type")
34
print("[Lua] ending onEvent")
b'\\ No newline at end of file'