foxygit / fake-08-xbox360 Log in
commit 1b24f5dd2e300a359b8027ea04f119818e561da5
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sun Apr 16 19:17:00 2023 -0600
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Sun Apr 16 19:17:00 2023 -0600

    add string indexing

    implemented in global lua functions. Might be better to implement in
    z8lua later?
---
 source/p8GlobalLuaFunctions.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/source/p8GlobalLuaFunctions.h b/source/p8GlobalLuaFunctions.h
index d3793da..5081dac 100644
--- a/source/p8GlobalLuaFunctions.h
+++ b/source/p8GlobalLuaFunctions.h
@@ -11,6 +11,9 @@ const char * p8GlobalLuaFunctions = R"#(
 --Table Helpers
 ---------------------------------

+--string indexing: https://lua-users.org/wiki/StringIndexing
+getmetatable('').__index = function(str,i) return string.sub(str,i,i) end
+
 --from zepto 8 bios.p8
 -- PicoLove functions did not return values added/deleted