Lua stack frame refactor

This commit is contained in:
Zef Hemel
2024-10-20 15:06:23 +02:00
parent 64c98678bc
commit 8acb112e4e
14 changed files with 300 additions and 201 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { LuaBuiltinFunction, LuaTable } from "$common/space_lua/runtime.ts";
export const osApi = new LuaTable({
time: new LuaBuiltinFunction((tbl?: LuaTable) => {
time: new LuaBuiltinFunction((_sf, tbl?: LuaTable) => {
if (tbl) {
// Build a date object from the table
const date = new Date();
@@ -32,7 +32,7 @@ export const osApi = new LuaTable({
* If format is not "*t", then date returns the date as a string, formatted according to the same rules as the ISO C function strftime.
* If format is absent, it defaults to "%c", which gives a human-readable date and time representation using the current locale.
*/
date: new LuaBuiltinFunction((format: string, timestamp?: number) => {
date: new LuaBuiltinFunction((_sf, format: string, timestamp?: number) => {
const date = timestamp ? new Date(timestamp * 1000) : new Date();
// Default Lua-like format when no format string is provided