gudzpoz / luajava

Lua for Java on Windows, Mac OS X, Linux, Android. 5.1, 5.2, 5.3, 5.4, LuaJ or LuaJIT.
https://gudzpoz.github.io/luajava/
Other
122 stars 14 forks source link

Add newTable method at Lua interface #173

Closed dayo05 closed 1 month ago

dayo05 commented 2 months ago

This PR simply adds newTable() method(with default invocation) to Lua interface.

The newTable seems exists on native lua code and highly used on beginner-level code instead its equivalent: createTable(0, 0).

Also, because the LuaNative.newTable exists, its good to add it into interface too.

I just add it via default method of interface because I use github edit page to modify this but if you want then I'll change it to use method inside LuaNative.

gudzpoz commented 1 month ago

Can you please add a tiny test (probably in LuaTestSuite.java)? https://github.com/gudzpoz/luajava/blob/deb4184acf8489cd4b30169672bf256578a4a62b/example/suite/src/main/java/party/iroiro/luajava/LuaTestSuite.java#L918

Something as simple as this will do:

        L.newTable();
        assertEquals(TABLE, L.type(-1));
dayo05 commented 1 month ago

Can you please add a tiny test (probably in LuaTestSuite.java)?

https://github.com/gudzpoz/luajava/blob/deb4184acf8489cd4b30169672bf256578a4a62b/example/suite/src/main/java/party/iroiro/luajava/LuaTestSuite.java#L918

Something as simple as this will do:

        L.newTable();
        assertEquals(TABLE, L.type(-1));

Done

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.55%. Comparing base (f6872e0) to head (85edfdb). Report is 32 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #173 +/- ## ============================================ + Coverage 92.73% 96.55% +3.81% - Complexity 847 913 +66 ============================================ Files 43 44 +1 Lines 2368 2467 +99 Branches 281 286 +5 ============================================ + Hits 2196 2382 +186 + Misses 125 61 -64 + Partials 47 24 -23 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gudzpoz commented 1 month ago

Thanks!