feat: add math.atan2, math.copysign, string.charpattern, loadfile - #293
Merged
Conversation
- math.atan2(y, x): two-argument arctangent - math.copysign(x, y): copy sign of y to magnitude of x - string.charpattern: compile-time constant pattern "[^%z]" - loadfile(filename): load Lua source from file, compile directly so top-level functions become global, return closure that executes the chunk's __fakelua_init when called Co-Authored-By: Claude <noreply@anthropic.com>
All four modules (math, table, string, basic) now use the same categorized sub-heading style for consistency. Co-Authored-By: Claude <noreply@anthropic.com>
fakelua files only contain functions and constants, no top-level executable code. After CompileString, the compiler's __fakelua_init runs automatically. So loadfile just compiles the file directly (top-level functions become global) and returns nil. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #293 +/- ##
==========================================
+ Coverage 90.77% 90.80% +0.02%
==========================================
Files 76 76
Lines 17439 17511 +72
==========================================
+ Hits 15831 15901 +70
- Misses 1608 1610 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
math.atan2(y, x): two-argument arctangentmath.copysign(x, y): copy sign of y to magnitude of xstring.charpattern: compile-time constant pattern"[^%z]"(matches any character except null)loadfile(filename): load Lua source from file, compile directly so top-level functions become global, return closure that executes the chunk when calledImplementation
math.atan2/math.copysign: registered as native functions innative_math.cppstring.charpattern: compile-time constant interception inc_gen.cpp(same pattern asmath.pi)loadfile: reads file, compiles viaCompileString(so globals register properly), returns a closure with special marker\x1bLoadFilethatFlEvalLoadClosurerecognizes to call__fakelua_initdirectlyTest Coverage
test_math.test_math_atan2test_math.test_math_copysigntest_string.test_string_charpatterntest_string.test_string_loadfile