lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Philipp Kraus
> Sent: donderdag 22 augustus 2013 13:02
> To: list mailing Lua
> Subject: module with c api
> 
> Hello,
> 
> I have got some modules (LUA script files) which are used with
> 
> local mymodul = require "mymodule"
> 
> All data is converted to a database, so each LUA script should be a row in

Is "data" the source code or the compiled byte code? In the latter case it is not portable, so be aware of that.

> my table.
> How can I use the code (without any changes)?
> 
> I use on C side lua_loadstring to load the script data, so I have concated
> all rows
> and all the load string function, but imho the require should fail.
> 
> My tasks are: I have got some pure LUA modules which are stored in clob
> fields
> in the database. On a used defined action all moduls items should be
> pushed
> with the main script to the interpreter.
> 
> Can anybody send me some tips?
> 
> Thanks
> 
> Phil

Try loaders, see [1]. Create a loader that checks your database for the requested module and fetches it.

Thijs

[1] http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders