MCPcopy Create free account
hub / github.com/Ahmeth4n/renef / lua_java_instance_index

Function lua_java_instance_index

src/agent/lua/api_java.c:957–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955};
956
957static int lua_java_instance_index(lua_State* L) {
958 const char* key = luaL_checkstring(L, 2);
959 if (strcmp(key, "raw") == 0) {
960 jobject* ud = (jobject*)lua_touserdata(L, 1);
961 if (*ud) {
962 JNIEnv* env = get_jni_env();
963 if (env) {
964 void* raw = jni_ref_to_raw_ptr(env, *ud);
965 lua_pushinteger(L, (lua_Integer)(uintptr_t)raw);
966 } else {
967 lua_pushinteger(L, (lua_Integer)(uintptr_t)*ud);
968 }
969 } else {
970 lua_pushinteger(L, 0);
971 }
972 return 1;
973 }
974 if (strcmp(key, "call") == 0) {
975 lua_pushcfunction(L, lua_java_call_instance);
976 return 1;
977 }
978 lua_pushnil(L);
979 return 1;
980}
981
982static const luaL_Reg java_instance_methods[] = {
983 {"__gc", lua_java_instance_gc},

Callers

nothing calls this directly

Calls 2

get_jni_envFunction · 0.85
jni_ref_to_raw_ptrFunction · 0.85

Tested by

no test coverage detected