Skip to content

Commit

Permalink
Add int_to_hex (#384)
Browse files Browse the repository at this point in the history
* Add int_to_hex

* Update index.ts

* Update lua.test.md
  • Loading branch information
Shanethegamer authored Apr 25, 2024
1 parent c1668d3 commit 8b0c8a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/languages/lua/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const luaLanguage: Language = {
mapOps({
int_to_dec: (a) =>
op["concat[Text]"](text(""), implicitConversion("int_to_dec", a)),
int_to_hex: (a) => func("string.format", text("%x"), a),
join: (a, b) => func("table.concat", isText("")(b) ? [a] : [a, b]),
"char[byte]": (x) => func("string.char", x),

Expand Down
2 changes: 2 additions & 0 deletions src/languages/lua/lua.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ concat $b "xyz";
text_byte_length $b;
int_to_text 5;
text_to_int "5";
int_to_hex 10;
text_replace $b "a" "A";
text_replace $b "(" "*";
text_replace $b $b:(Text 1..oo) $b;
Expand Down Expand Up @@ -106,6 +107,7 @@ b.."xyz"
b:len()
""..5
1*"5"
string.format("%x",10)
b:gsub("a","A")
b:gsub("%(","*")
b:gsub(b:gsub("(%W)","%%%1"),b:gsub("%%","%%%%"))
Expand Down

0 comments on commit 8b0c8a3

Please sign in to comment.