MCPcopy Create free account
hub / github.com/MCJack123/craftos2 / call

Method call

examples/example_peripheral.cpp:24–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 example_peripheral(lua_State *L, const char * side) {}
23 ~example_peripheral(){}
24 int call(lua_State *L, const char * method) {
25 std::string m(method);
26 if (m == "add") return add(L);
27 else if (m == "subtract") return subtract(L);
28 else if (m == "ping") return ping(L);
29 else return luaL_error(L, "No such method");
30 }
31 static peripheral * init(lua_State *L, const char * side) {return new example_peripheral(L, side);}
32 static void deinit(peripheral * p) {delete (example_peripheral*)p;}
33 virtual destructor getDestructor() const {return deinit;}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected