-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small errors found with trains/events #144
Comments
Ok, I have this fixed for the next release because I forgot to check issues before the last release. Go ME! |
Forgot to include the required event_name string parameter when using |
Sometimes I wish lua was more strongly typed! Or my memory wasn't so!
…On Sun, Sep 29, 2019, 7:44 AM chrisgbk ***@***.***> wrote:
Forgot to include the required event_name string parameter when using
Event.generate_event_name() in the patch.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#144?email_source=notifications&email_token=ADKTFYETPUWI6ADFABW7TNTQMCIKRA5CNFSM4IZBPT32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD73SBOY#issuecomment-536289467>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADKTFYD5MJ77CSWA4XCX5PTQMCIKRANCNFSM4IZBPT3Q>
.
|
Well Metalua can perform strong typechecking at runtime, though there is a runtime overhead for it. typedlua is a preprocessor that takes a typed lua (performing type checks) to convert to normal lua without the annotations. It's deprecated as the authors are working on a new language called Titan,owever, Typed Lua is supposedly 'fully functional' and has no runtime overhead, generates standard LUA 5.1 (which is what factorio uses as I recall?), instead you'd just run the typedlua lua program over the 'tl' (typed lua) source code files to generate normal lua files, that could then be used as normal. On a plus side mod authors could use either normal lua, or they could use typedlua against stdlib's typedlua files so they could be statically typed as well (further bonus if stdlib 'types' the entire factorio api, even that which it does not use). In addition it can be loaded at runtime as well (as the typedlua engine is still just normal lua code) if for some reason you want to perform runtime checks. Or of course use titan straight, less of a Or lastly, the crème de la crème of strongly statically typed lua is of course the Haxe Programming Language, the language that compiles to dang near everything in existence, including being able to output LUA. You'd just write normal haxe code, it output normal lua files when you run the haxe compiler, all statically and strongly type checked. Users of stdlib would be able to write lua or haxe code. It generates very ugly although very efficient code, it does add about 300 lines of prelude as a set of helpers for lua access that aren't intended for use by end user and thus aren't exported, they can be ignored, though there are lots of useful things like being able to add injection trace calls (wonderful for debugging) among a lot more. Though my dream would be for factorio to drop lua and just wasm instead, it would be faster, even better sandboxed than lua, and you can use it with whatever language you want, or even mixture of languages, including lua. And with the WASI spec finally standardizing it's all even easier! If only... ^.^; Hmm, interesting idea though, a Haxe project management for mod authoring in factorio... Strong Static typing would just outright prevent so many classes of common bugs that happen in mods... |
@Nexela @OvermindDL1 TypeScriptToLua and Typed Factorio solve the strongly-typed Lua problem :) |
@aSemy It does! I've been using typescript to lua for a while now, it works really well! It generates very nice output too. |
Factorio-Stdlib/stdlib/event/event.lua
Line 68 in f371fc4
Should be:
error('Detected attempt to register an event using script.' .. name .. ' while using the STDLIB event system ' .. (id and id or ''))
If this branch gets executed, the result is
attempt to concatenate local 'id' (a nil value)
instead of the actual intended error occurring, due to .. having higher precedence than and/or.Which leads to:
Factorio-Stdlib/stdlib/event/trains.lua
Line 26 in f371fc4
Should use Event module, not script directly, as the Event module overrides script to error when called directly.
The text was updated successfully, but these errors were encountered: