LUA output (print)

BlitzMax Forums/BlitzMax Programming/LUA output (print)

Hi,

Why is the LUA print output not shown until program termination?

Also if you manually terminate the program, by pressing the stop button in the IDE the output is never shown.

Is it just an IDE thing or something else?
Strict

Import axe.luascript

Function LUA_MyFunction( ls:Byte Ptr )
     lua.ReturnStringToLua("Hello, World!")
     Return 1  'returning one variable
End Function

Function LUA_MyFunction2( ls:Byte Ptr )
	Notify "ding dong"
	Return 1  'returning one variable
End Function

Global lua:TLuaScriptEngine=New TLuaScriptEngine

lua.reset()

lua.addFunction(LUA_MyFunction,"MyFunction")
lua.addFunction(LUA_MyFunction2,"MyFunction2")

lua.SetScriptText "print(MyFunction())~nprint(MyFunction())~nMyFunction2()","myscript"

lua.RunScript

lua.Shutdown()

Delay 3000


Hmm, they seem to have left out any flush in their print string implementation (for speed purposes?) so quick fix is to call:

StandardIOStream.Flush

before your delay