mirror of https://github.com/Hilbis/Hilbish
docs: update changelog and docs referencing how objects are userdata
parent
e656b8f210
commit
10337af11e
|
@ -56,6 +56,9 @@ This is probably one of (if not the) biggest things in this release.
|
||||||
user input, exit code, and error. User input has been added to the return to
|
user input, exit code, and error. User input has been added to the return to
|
||||||
account for runners wanting to prompt for continued input, and to add it
|
account for runners wanting to prompt for continued input, and to add it
|
||||||
properly to history.
|
properly to history.
|
||||||
|
- **Breaking Change:** Job objects and timers are now Lua userdata instead
|
||||||
|
of a table, so their functions require you to call them with a colon instead
|
||||||
|
of a dot. (ie. `job.stop()` -> `job:stop()`)
|
||||||
- All `fs` module functions which take paths now implicitly expand ~ to home.
|
- All `fs` module functions which take paths now implicitly expand ~ to home.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -20,8 +20,11 @@ and `execPath` is an absolute path for the command executable.
|
||||||
- `disown(id)`: Removes a job by ID from the job table.
|
- `disown(id)`: Removes a job by ID from the job table.
|
||||||
|
|
||||||
# Job Object
|
# Job Object
|
||||||
A job object on the Lua side is a table with some functions.
|
A job object is a piece of `userdata`. All the functions of a job require
|
||||||
On the under side it represents a job in the job table.
|
you to call them with a colon, since they are *methods* for the job object.
|
||||||
|
Example: hilbish.jobs.last():foreground()
|
||||||
|
Which will foreground the last job.
|
||||||
|
|
||||||
You can still have a job object for a disowned job,
|
You can still have a job object for a disowned job,
|
||||||
it just won't be *working* anywhere. :^)
|
it just won't be *working* anywhere. :^)
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,17 @@ a timer via ID.
|
||||||
when the timer is triggered.
|
when the timer is triggered.
|
||||||
|
|
||||||
# Timer Object
|
# Timer Object
|
||||||
Those previously mentioned functions return a `timer` object, to which you can
|
All those previously mentioned functions return a `timer` object, to which
|
||||||
stop and start a timer again. The functions of the timers interface also
|
you can stop and start a timer again.
|
||||||
return a timer object.
|
|
||||||
|
An example of usage:
|
||||||
|
local t = hilbish.timers.create(1, 5000, function()
|
||||||
|
print 'hello!'
|
||||||
|
end)
|
||||||
|
|
||||||
|
t:stop()
|
||||||
|
print(t.running, t.duration, t.type)
|
||||||
|
t:start()
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
- `duration`: amount of time the timer runs for in milliseconds
|
- `duration`: amount of time the timer runs for in milliseconds
|
||||||
|
|
Loading…
Reference in New Issue