how to put the entire .lua script in my program as a string ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 388
Joined: Fri Dec 04, 2015 9:26 pm

how to put the entire .lua script in my program as a string ?

Post by skinkairewalker »

hello everyone !!
i would like to know how i add a script.lua to my as a string like this :

Json.lua Library : https://github.com/rxi/json.lua

do this

Code: Select all

luaL_dostring(L,"json = dofile('json.lua')");
like this :

Code: Select all

luaL_dostring(L, "json = {CODE_INSIDE_JSON.LUA} ");  without having to call the file, json.lua, but loading the code inside...

I found something that might help, but I have no idea how to do that with the Dadido wrapper : https://github.com/Dadido3/Lua-PureBasic

i found this : http://lua-users.org/wiki/BinToCee

I would be very grateful if someone could help me...
User avatar
Keya
Addict
Addict
Posts: 1865
Joined: Thu Jun 04, 2015 7:10 am

Re: how to put the entire .lua script in my program as a string ?

Post by Keya »

could you use IncludeBinary("json.lua") in a DataSection, then point a string ptr to it?
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 388
Joined: Fri Dec 04, 2015 9:26 pm

Re: how to put the entire .lua script in my program as a string ?

Post by skinkairewalker »

dont works :c
User avatar
Keya
Addict
Addict
Posts: 1865
Joined: Thu Jun 04, 2015 7:10 am

Re: how to put the entire .lua script in my program as a string ?

Post by Keya »

also test if it might be an ascii vs. unicode string issue
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 388
Joined: Fri Dec 04, 2015 9:26 pm

Re: how to put the entire .lua script in my program as a string ?

Post by skinkairewalker »

to avoid a lot of hassle, I downloaded luac and I'm going to compile dependency modules with luac, I think it solves temporarily...

Thank you very much for the attention Keya !!! :D
Post Reply