This hack wins the interwebsquyxkh wrote:ugly but efficient hack: lua strings are atoms, equality testing is just pointer testing, test the help() string.
Trying that in x=1,1000 loops says it's dirt cheap.Code: Select all
if entity.help() == stored_player_help then
Search found 1828 matches
- Sat Feb 17, 2018 4:12 am
- Forum: Implemented mod requests
- Topic: Please add table_type to LuaEntity and LuaPlayer
- Replies: 21
- Views: 5184
Re: Please add table_type to LuaEntity and LuaPlayer
- Sat Feb 17, 2018 4:11 am
- Forum: Implemented mod requests
- Topic: Please add table_type to LuaEntity and LuaPlayer
- Replies: 21
- Views: 5184
Re: Please add table_type to LuaEntity and LuaPlayer
I see now, interesting. How expensive is pcall as far as performance goes compared to directly calling a function? I have been warned away from using errors as control flow, but in this case it may be your best option. I did some quick tests, and pcall with an error seems to take about 40 microseco...
- Wed Feb 14, 2018 4:47 am
- Forum: Tools
- Topic: [0.13-0.15] [Library]Factorio Standard Library Project 0.8.0
- Replies: 59
- Views: 46610
Re: [0.13-0.15] [Library]Factorio Standard Library Project 0.8.0
Data-library is the currently in development branch and is very much wip and data-library-wip is/was the OMG I am breaking things every time I type branch. (Actually I only did this branch because symlinks and I didn't want to update a bunch of mods until I was mostly done with it) Most data-library...
- Thu Feb 08, 2018 5:28 am
- Forum: Technical Help
- Topic: Desync issues and map download speed issues, help!
- Replies: 6
- Views: 1725
Re: Desync issues and map download speed issues, help!
Desync is caused by research progress frame. Feel free to remove that mod and set it on fire.
- Tue Feb 06, 2018 12:12 am
- Forum: Mods
- Topic: [MOD 0.12.x] Autofill
- Replies: 293
- Views: 226108
Re: [MOD 0.12.x] Autofill
It is a lack of time / still broken kind of thing.
- Tue Feb 06, 2018 12:01 am
- Forum: Modding discussion
- Topic: LuaPlayer.can_place_entity wrong number of args
- Replies: 4
- Views: 1706
Re: LuaPlayer.can_place_entity wrong number of args
What bob i saying is..... If the only argument passed to a function is a literal string or literal table, the parenthesis can be omitted
function "string-arg"
function {}
is the same as
function("string-arg")
function({})
function "string-arg"
function {}
is the same as
function("string-arg")
function({})
- Sat Feb 03, 2018 11:11 pm
- Forum: Not a bug
- Topic: [16.22] Desync in scenario
- Replies: 4
- Views: 1265
Re: [16.22] Desync in scenario
The second, if you initialize global variable this way, it will be reinitialized for anyone who joins the multiplayer. You need to initialize your global in on_init event. Assuming "if you initilize global variable this way" means from your example _G.global[v] = blah in multiplayer decla...
- Sat Feb 03, 2018 11:01 pm
- Forum: Ideas and Suggestions
- Topic: make 'mode of operation' more clear in GUI
- Replies: 4
- Views: 1218
Re: make 'mode of operation' more clear in GUI
I agree The two buttons for circuit/logic should have a green background when connected to wires/ connected to network.
- Sat Feb 03, 2018 2:27 am
- Forum: Angels Mods
- Topic: Gas Trains can Load Liquids?
- Replies: 2
- Views: 1422
Re: Gas Trains can Load Liquids?
A gas and a liquid are both fluids. a storage tank holds fluids. The only way to "fix" this would be a different tanker for every fluid which isn't feasible.
- Tue Jan 30, 2018 5:44 am
- Forum: Modding help
- Topic: How do dynamically (un)registered event handlers behave?
- Replies: 2
- Views: 927
Re: How do dynamically (un)registered event handlers behave?
It is truly unregistered and gone. And can lead to desyncs in multiplayer if not handled correctly. You need to make sure to have a control variable in global and register in on_load if needed. some_func = blah on_load -> if global.some_var then on_tick = some_func on_some_event -> global.some_var =...
- Mon Jan 29, 2018 1:37 am
- Forum: Modding help
- Topic: How to create an infinite chest and set him a filter?
- Replies: 3
- Views: 7603
Re: How to create an infinite chest and set him a filter?
Code: Select all
/c game.surfaces[1].create_entity{ name = "infinity-chest", position = {game.player.position.x+3, game.player.position.y}, force=game.player.force } }.set_infinity_filter(1, "iron-plate")
- Sun Jan 28, 2018 7:34 am
- Forum: Modding help
- Topic: data.raw["recipe"] does not exist
- Replies: 6
- Views: 2325
Re: data.raw["recipe"] does not exist
settings.lua is a special file ran in the settings stage which is before the data stage, Simply rename this file (and where it is required from) to something else.
- Sun Jan 28, 2018 6:57 am
- Forum: Modding help
- Topic: data.raw["recipe"] does not exist
- Replies: 6
- Views: 2325
Re: data.raw["recipe"] does not exist
Somewhere before the fluid code then you must be doing data.raw = {} ?
You will have to package everything up so we can take a look
You will have to package everything up so we can take a look
- Sun Jan 28, 2018 6:48 am
- Forum: Modding help
- Topic: data.raw["recipe"] does not exist
- Replies: 6
- Views: 2325
Re: data.raw["recipe"] does not exist
Post the whole code, or at least the whole code that adds the fluid.
- Sun Jan 28, 2018 12:20 am
- Forum: Modding help
- Topic: Issues linking Recipt
- Replies: 1
- Views: 577
Re: Issues linking Recipt
you have an entity (car) and a recipe, you don't have an item.
- Thu Jan 25, 2018 6:23 pm
- Forum: Mods
- Topic: [MOD 0.12.26] Picker: Easily select items from inventory
- Replies: 125
- Views: 64162
Re: [MOD 0.12.26] Picker: Easily select items from inventory
That is a hard crash of the game (still probably related to me doing something wrong though)
- Thu Jan 25, 2018 3:49 am
- Forum: Mods
- Topic: [MOD 0.12.x] Autofill
- Replies: 293
- Views: 226108
Re: [MOD 0.12.x] Autofill
Lots of things are currently still broken and on my too fix list as soon as time permits!
- Sat Jan 20, 2018 2:36 am
- Forum: Modding help
- Topic: Mod-added logistic storage chest not getting filter in GUI
- Replies: 2
- Views: 859
Re: Mod-added logistic storage chest not getting filter in GUI
logistic_slots_count = 1
needs to be set on your prototype for the filter gui to show up.
needs to be set on your prototype for the filter gui to show up.
- Mon Jan 15, 2018 6:14 am
- Forum: Mods
- Topic: [MOD 0.16] Miniloader
- Replies: 394
- Views: 156620
Re: [MOD 0.16] Miniloader
Nanobots raises the on_built_entity event instead of the on_robot_built_entity. Since this is the event for a player building something, and it's normally impossible for a player to build an entity that is already connected to a circuit network or with circuit conditions set This was a toss up at t...
- Mon Jan 15, 2018 5:49 am
- Forum: Mods
- Topic: [MOD 0.12.26] Picker: Easily select items from inventory
- Replies: 125
- Views: 64162
Re: [MOD 0.12.26] Picker: Easily select items from inventory
Would you consider adding a remote interface to allow mods to opt-out from the dolly functionality? For miniloaders, which are multiple entities, one of the inserters is the selectable entity, so it can be circuit connected. The inserter can be teleported, and so PickerExtended does, but the belt c...