aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/lua.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-01-12 17:34:14 +0100
committercbdev <cb@cbcdn.com>2020-01-12 17:34:14 +0100
commit78b21a9ac3f975f35ec7b61108531e1495eb91c0 (patch)
treef41cfc78f3392d501293c3afdd7b42111c863615 /backends/lua.c
parent0a696be5af7db63c1c7354518c839d8543f1ba25 (diff)
downloadmidimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.tar.gz
midimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.tar.bz2
midimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.zip
Rework instance creation
Diffstat (limited to 'backends/lua.c')
-rw-r--r--backends/lua.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/backends/lua.c b/backends/lua.c
index 510fc72..7d20fb1 100644
--- a/backends/lua.c
+++ b/backends/lua.c
@@ -304,16 +304,11 @@ static int lua_configure_instance(instance* inst, char* option, char* value){
return 1;
}
-static instance* lua_instance(){
- instance* inst = mm_instance();
- if(!inst){
- return NULL;
- }
-
+static int lua_instance(instance* inst){
lua_instance_data* data = calloc(1, sizeof(lua_instance_data));
if(!data){
LOG("Failed to allocate memory");
- return NULL;
+ return 1;
}
//load the interpreter
@@ -321,7 +316,7 @@ static instance* lua_instance(){
if(!data->interpreter){
LOG("Failed to initialize interpreter");
free(data);
- return NULL;
+ return 1;
}
luaL_openlibs(data->interpreter);
@@ -338,7 +333,7 @@ static instance* lua_instance(){
lua_settable(data->interpreter, LUA_REGISTRYINDEX);
inst->impl = data;
- return inst;
+ return 0;
}
static channel* lua_channel(instance* inst, char* spec, uint8_t flags){