MCPcopy Create free account
hub / github.com/danomatika/ofxLua / init

Method init

src/ofxLua.cpp:55–84  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

53
54//------------------------------------------------------------------------------
55bool ofxLua::init(bool abortOnError, bool openLibs, bool ofBindings) {
56
57 clear();
58
59 L = luaL_newstate();
60 if(L == NULL) {
61 ofLogError("ofxLua") << "Error initializing lua";
62 return false;
63 }
64
65 // open libs
66 if(openLibs) {
67 luaL_openlibs(L);
68 }
69 if(ofBindings) {
70 luaopen_of(L);
71 luaopen_glm(L);
72 }
73
74 // clear stack since opening libs leaves tables on the stack
75 lua_settop(L, 0);
76
77 // set the panic function
78 lua_atpanic(L, &atPanic);
79
80 this->abortOnError = abortOnError;
81 ofLogVerbose("ofxLua") << "Initialized state";
82
83 return true;
84}
85
86void ofxLua::clear() {
87 if(L != NULL) {

Callers 4

setupMethod · 0.80
keyPressedMethod · 0.80
setupMethod · 0.80
loadScriptMethod · 0.80

Calls 3

luaL_newstateFunction · 0.85
luaL_openlibsFunction · 0.85
lua_settopFunction · 0.85

Tested by

no test coverage detected