fix bl.schedule errors

This commit is contained in:
Redo
2025-10-02 14:35:03 -05:00
parent de9992aa2c
commit fe9ee3cc2b
5 changed files with 9 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,8 @@
# BlockLua # BlockLua
Lua scripting for Blockland
## How to Install ## How to Install
- Install RedBlocklandLoader - Install RedBlocklandLoader
- Copy `lua5.1.dll` into your Blockland install folder, next to `Blockland.exe` - Copy `lua5.1.dll` into your Blockland install folder, next to `Blockland.exe`
@@ -64,9 +67,11 @@ Relative paths (`./`) are allowed. `..` is not allowed.
`file:write(string)` - Write an opened file (must be opened in 'w' (write), 'a' (append), 'wb' or 'ab' mode) `file:write(string)` - Write an opened file (must be opened in 'w' (write), 'a' (append), 'wb' or 'ab' mode)
`file:close()` - Close an opened file `file:close()` - Close an opened file
Reading files from ZIPs is supported, with caveats. Null characters are not allowed, and \r\n becomes \n. Generally, text formats work, and binary formats don't. Reading files from ZIPs is supported, with caveats. Null characters are not allowed, and \r\n becomes \n. Generally, text formats work, and binary formats don't.
When reading from outside ZIPs, binary files are fully supported.
### Modules and Dependencies ### Modules and Dependencies
`dofile('Add-Ons/Path/file.lua')` - Execute a Lua file. Relative paths (`./file.lua`) are allowed. `..` is not allowed. `dofile('Add-Ons/Path/file.lua')` - Execute a Lua file. Relative paths (`./file.lua`) are allowed. `..` is not allowed.
`require('modulePath.moduleName')` - Load a Lua file or or external library. `require('modulePath.moduleName')` - Load a Lua file or or external library.
Require replaces `.` with `/` in the path, and then searches for files in the following order: Require replaces `.` with `/` in the path, and then searches for files in the following order:
- `./modulePath/moduleName.lua` - `./modulePath/moduleName.lua`
@@ -76,6 +81,7 @@ Require replaces `.` with `/` in the path, and then searches for files in the fo
- `modules/lualib/modulePath/moduleName.lua` - `modules/lualib/modulePath/moduleName.lua`
- `modules/lualib/modulePath/moduleName/init.lua` - `modules/lualib/modulePath/moduleName/init.lua`
- `modules/lualib/modulePath/moduleName.dll` - `modules/lualib/modulePath/moduleName.dll`
Like in standard Lua, modules loaded using `require` are only executed the first time `require` is called with that path. Subsequent calls simply return the result from the initial execution. To allow hot reloading, use `dofile`. Like in standard Lua, modules loaded using `require` are only executed the first time `require` is called with that path. Subsequent calls simply return the result from the initial execution. To allow hot reloading, use `dofile`.
## Type Conversion ## Type Conversion

View File

@@ -538,7 +538,7 @@ function _bllua_schedule_callback(id)
id = tonumber(id) id = tonumber(id)
local sch = bl._scheduleTable[id] local sch = bl._scheduleTable[id]
if not sch then error('_ts_schedule_callback: no schedule with id '..id) end if not sch then error('_ts_schedule_callback: no schedule with id '..id) end
bl._scheduleTable[sched_id] = nil bl._scheduleTable[id] = nil
sch.callback(unpack(sch.args)) sch.callback(unpack(sch.args))
end end