Page 1 of 1
someone already use squirrel with PB ?
Posted: Thu Apr 14, 2016 6:34 pm
by skinkairewalker
hi everyone
i have problems to compile my script " .nut " in squirrel lang vm with pb
someone have experience to give me some code what works with PB to compile simples "HelloWorld.nut" script ?
i am using this code , but dont works :/ :
Code: Select all
ImportC "squirrel.lib"
sq_open.i (stacksize.l)
sq_close(*vm)
sq_compile(vm, read, p, sourcename, raiseerror)
EndImport
*vm = sq_open(1024)
Debug *vm
sq_compile(*vm, "myfile.nut", 0, "helloworld", 1)
sq_close(*vm)
Re: someone already use squirrel with PB ?
Posted: Thu Apr 14, 2016 10:32 pm
by infratec
Hi,
maybe a stupid question:
For what do you need PB?
Only to program in LUA or Squirrel or ...
It is always better and faster to program all in PB.
Or is there something in LUA or Squirrel what not can be done in PB?
Bernd
Re: someone already use squirrel with PB ?
Posted: Fri Apr 15, 2016 3:53 am
by skinkairewalker
Thanks by you answer infratec
so , i would like edit my applications without having to recompile the application in PB ...
Squirrel or Lua are very usefull to do this

Re: someone already use squirrel with PB ?
Posted: Fri Apr 15, 2016 5:58 pm
by skinkairewalker
i am trying use this code below >
Code: Select all
ImportC "squirrel.lib"
sq_open.i(stacksize.l)
sq_pop(*vm,nelementstoppop.i)
sq_close(*vm)
sq_pushroottable(*vm)
sq_pushstring(*vm,f.s,len.i);
sq_get(*vm,idx.i); //get the function from the root table
sq_pushinteger(*vm,ni.i);
sq_pushfloat(*vm,nf.f);
sq_call(*vm,param.i,retval.b,raiseerror.b);
EndImport
ImportC "sqstdlib.lib"
sqstd_dofile(*vm,f.s,retval.b,printerror.b)
sqstd_loadfile(*vm,filename.s,printerror.b)
EndImport
*vm = sq_open(1024)
Debug sq_pushroottable(*vm)
If *vm
Debug sqstd_dofile(*vm,"test1.nut",#False,#True)
Debug sq_pushroottable(*vm);
Debug sq_pushstring(*vm,"foo",-1);
Debug sq_get(*vm,-2); //get the function from the root table
Debug sq_pushroottable(*vm); //’this’ (function environment object)
Debug sq_pushinteger(*vm,1);
Debug sq_pushfloat(*vm,2.0);
Debug sq_pushstring(*vm,"three",-1);
Debug sq_call(*vm,4,#False,#True);
Debug sq_pop(*vm,2);
EndIf
loaded = sqstd_loadfile(*vm,"test.nut",#True )
If loaded
Debug "something happens ;-; "
EndIf
sq_close(*vm)
;Debug sqstd_register_iolib(1)
but , in sq_dofile() return -1
'-' what am i doing wrong ?
Re: someone already use squirrel with PB ?
Posted: Fri Apr 15, 2016 8:57 pm
by infratec
Code: Select all
ImportC "squirrel.lib"
sq_open.i(stacksize.l)
sq_pop(*vm, nelementstoppop.l)
sq_close(*vm)
sq_pushroottable(*vm)
sq_pushstring(*vm, f.p-ascii, len.l)
sq_get(*vm, idx.l)
sq_pushinteger(*vm, ni.l)
sq_pushfloat(*vm, nf.f)
sq_call(*vm, param.l, retval.l, raiseerror.l)
EndImport
ImportC "sqstdlib.lib"
sqstd_dofile(*vm, filename.p-ascii, retval.l, printerror.l)
sqstd_loadfile(*vm, filename.p-ascii, printerror.l)
EndImport
Bernd
Re: someone already use squirrel with PB ?
Posted: Sat Apr 16, 2016 1:38 pm
by skinkairewalker
infratec wrote:Code: Select all
ImportC "squirrel.lib"
sq_open.i(stacksize.l)
sq_pop(*vm, nelementstoppop.l)
sq_close(*vm)
sq_pushroottable(*vm)
sq_pushstring(*vm, f.p-ascii, len.l)
sq_get(*vm, idx.l)
sq_pushinteger(*vm, ni.l)
sq_pushfloat(*vm, nf.f)
sq_call(*vm, param.l, retval.l, raiseerror.l)
EndImport
ImportC "sqstdlib.lib"
sqstd_dofile(*vm, filename.p-ascii, retval.l, printerror.l)
sqstd_loadfile(*vm, filename.p-ascii, printerror.l)
EndImport
Bernd
Thanks by you answer infratec ^^
in sqstd_dofile() i need put Filename in ASCII ?
Re: someone already use squirrel with PB ?
Posted: Sat Apr 16, 2016 7:19 pm
by infratec
it looks like.
Because when I use unicode it returns -1.
Re: someone already use squirrel with PB ?
Posted: Wed Apr 20, 2016 3:31 am
by skinkairewalker
infratec wrote:it looks like.
Because when I use unicode it returns -1.
thanks
infratec by you answer ^^
but anyway i yet don't get run a .nut script xD
do you have a example of how do i execute a .nut squirrel script ?