I am using LuaJava and C Code for Lua. What I am trying to do is read Lua source stored as a resource String in an Android application so that the Lua source read in can be executed. I need to know how to do this using LuaJava or C language.
I want to know how I can create a Lua module in Lua by using a String.
In other words, I am storing Lua source that would be stored in a .lua file in a String instead. I then want to load the contents of this string into Lua as an available module that can be called.
I see there is a loadstring()
function but not sure how this would be invoked for LuaJava or C.
I don't want Lua to search the file system for this file, I will find the file and convert it to a string. After I have the string, I need to know how to load the string copy of the file contents into Lua as a module that I can then call.
I also want to know if after calling loadstring(s)
if the module will remain available for subsequent function calls without having to reload do the loadstring()
again.