Minetest logo

IRC log for #minetest-dev, 2014-05-16

| Channels | #minetest-dev index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:02 SoniEx2 ShadowNinja, let me show you...
00:03 SoniEx2 local k,o,d=next,type d=function(a,r,t)if o{}~=o(a)then return a end t={}r=r or{}r[a]=t for x,y in k,a do t[r[x]or d(x,r)]=r[y]or d(y,r)end return t end table.copy={shallow=function(a,b)b={}for x,y in k,a do b[x]=y end return b end,deep=d}
00:04 SoniEx2 use the deep copy with a custom r and you can do fancy hax
00:07 SoniEx2 for example, table.copy.deep(sometable, setmetatable({}, {__index = function(t,k) return k end})) does a shallow copy
00:07 SoniEx2 (which can be done with table.copy.shallow)
00:07 SoniEx2 well
00:07 SoniEx2 sort of
00:07 SoniEx2 you need a no-op __newindex too
00:08 SoniEx2 but still
00:08 SoniEx2 anyway, basically you combine that code with metatables and you can easily do recursive pretty print, recursive dump, etc
00:09 SoniEx2 I should probably add metatable copying...
00:11 SoniEx2 ShadowNinja, anyway got it?
00:12 SoniEx2 plus you get a really simple (aka fast) table copy function...
00:19 Exio4 implement that in haskell and it will be easier to read
00:20 diemartin joined #minetest-dev
00:22 ShadowNinja SoniEx2: Um, yes, that's totally the cleanest and most readable way to implement it.  </sarcasm>
00:24 ShadowNinja SoniEx2: Also, these are dumping functions, not copying functions.
00:35 SoniEx2 ShadowNinja, why not both?
00:37 ShadowNinja SoniEx2: A copy function may be included in the future, but that's irrelivant to my patch and it certainly won't be the code you pasted.
00:38 SoniEx2 well my code fits IRC :3
00:43 zsoltisawesome left #minetest-dev
00:48 SoniEx2 ShadowNinja, this should be human readable: https://gist.github.com/SoniEx2/fc5d3614614e4e3fe131
00:48 jin_xi ShadowNinja: http://paste.org.ru/?xwauzc ?
00:50 SoniEx2 jin_xi, I looked at that if ... else if ... else if ... and thought "hmm I wonder how that would handle NULs"... then I saw you're removing it...
00:53 jin_xi basically this commit https://github.com/minetest/minetest/commit/2b1eff772524fca8249fd64028e5cbfeabc127a0 is very fishy
00:55 ShadowNinja SoniEx2: No, that just has some spacing.  It needs sane naming and structure.
00:56 SoniEx2 ShadowNinja, oh ok
00:56 SoniEx2 well it has sane structure now
00:56 SoniEx2 :P
00:56 diemartin joined #minetest-dev
00:57 SoniEx2 naming? replace "k" with "next", "o" with "type", "d" with "deep", "r" with "recursion", "a" with "in", "b" and "t" with "out"
01:06 pro joined #minetest-dev
01:07 SoniEx2 ShadowNinja, how about this: https://gist.github.com/SoniEx2/fc5d3614614e4e3fe131#file-tablecopy-sane-lua
01:08 SoniEx2 (as you asked for a sanity I also added recursion table validation to make sure it's a table)
01:09 ShadowNinja SoniEx2: Like so: https://gist.github.com/ShadowNinja/6a6c0ac7141c0812c3b2
01:10 SoniEx2 ShadowNinja, you use pairs
01:10 SoniEx2 5.2 has __pairs
01:11 SoniEx2 and I don't like "copies" being an internal parameter
01:11 ShadowNinja SoniEx2: So we should use ugly internal functions that aren't available in out current Lua version?
01:11 SoniEx2 not enough flexibility
01:12 SoniEx2 uhh
01:12 ShadowNinja SoniEx2: There's no external use for it.
01:12 SoniEx2 "next" exists in 5.1
01:12 ShadowNinja Yes, and?
01:12 SoniEx2 I have a use for it
01:12 SoniEx2 5.1, 5.2, 5.3 they all have "next"
01:13 SoniEx2 and please make local copies of the stuff
01:13 SoniEx2 (for sanity)
01:14 ShadowNinja SoniEx2: Yes, and?
01:14 SoniEx2 my function supports modding and metatables properly
01:15 ShadowNinja SoniEx2: Looks like it ignores metatables.
01:15 SoniEx2 it's moddable
01:15 SoniEx2 so it can easily support metatables
01:21 SoniEx2 ShadowNinja, here's a better example: https://gist.github.com/SoniEx2/fc5d3614614e4e3fe131#file-tablecopy-sane-lua
01:23 SoniEx2 (also I prefer to make a table.copy table and put the copy functions there because I feel it looks better...)
01:24 SoniEx2 hmm... I forgot to make a local copy of rawset and setmetatable...
01:24 SoniEx2 but still
01:49 SoniEx2 ShadowNinja, so...
02:21 VanessaE why does Minetestserver strip out things like /usr/lib/x86_64-linux-gnu/lua/5.1/ from lua module search path?
02:21 ShadowNinja VanessaE: It doesn't?
02:21 VanessaE it does.
02:22 VanessaE ./?.lua;/usr/local/share/luajit-2.0.2/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/minetest/.minetest/worlds/MG_World/worldmods/irc/?/init.lua;/home/minetest/.minetest/worlds/MG_World/worldmods/irc/?.lua
02:22 ShadowNinja SoniEx2: So, why not pairs?
02:22 VanessaE that's from earlier, before I re-built everything to be on the right search path.
02:22 ShadowNinja VanessaE: AFAIK Minetest doesn't touch any search paths.
02:22 VanessaE that's what I get at the start of the IRC mod.
02:23 VanessaE so minetest or something it does is altering the search paths
02:23 VanessaE the IRC entries aside, this ^^^ does not match what I get from lua on the command line
02:23 SoniEx2 ShadowNinja, because the code is supposed to be compatible with _at least_ Lua 5.1, LuaJIT, Lua 5.2, Lua 5.3
02:24 VanessaE default search path for command line Lua on the same box:  ./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua
02:24 VanessaE ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;/usr/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
02:24 VanessaE (and cpath)
02:24 ShadowNinja SoniEx2: pairs is available in 5.1.
02:24 SoniEx2 ShadowNinja, so basically, if you change the Lua version you probably won't have to change that piece of code
02:24 SoniEx2 ShadowNinja, so is next
02:25 ShadowNinja VanessaE: This is Minetest compiled with non-JIT Lua?
02:25 VanessaE with JIT.
02:25 SoniEx2 in Lua 5.1, pairs doesn't use the __pairs metamethod
02:25 SoniEx2 but in Lua 5.2+, it does
02:25 SoniEx2 so I can't use pairs in 5.2+
02:26 ShadowNinja SoniEx2: Why would we have to change that?  With 5.2 it respects __pairs if set.
02:26 SoniEx2 ShadowNinja, simply because I wanna copy all entries from a table
02:26 ShadowNinja VanessaE: Then check LuaJIT's paths.
02:26 SoniEx2 __pairs might combine the table and the metatable's __index together
02:26 SoniEx2 and I don't want that
02:26 VanessaE http://pastebin.ubuntu.com/7470915/
02:27 SoniEx2 or it might skip numbers
02:27 SoniEx2 that would be bad too
02:27 ShadowNinja SoniEx2: Hmmm,  O.K.
02:27 cheapie joined #minetest-dev
02:27 VanessaE strange, a few minutes ago, the x86_64 bit was in those paths.  now it isn't.
02:27 SoniEx2 it's easier to copy tables in C/C++
02:28 SoniEx2 in Lua you have to use "hacks"
02:28 VanessaE (well it was in the package.path anyway)
02:28 ShadowNinja VanessaE: So, is the LuaJIT interpreter's search path consistent with Minetest's?
02:28 SoniEx2 (altho it's more like an "exploit" or a "feature abuse")
02:29 VanessaE ShadowNinja:  http://pastebin.ubuntu.com/7470923/
02:29 VanessaE (also ShadowNinja, you have many /msgs waiting)
02:29 ShadowNinja SoniEx2: Well, in C++ "tables" are std::map, and since C++ has reference operators it makes copying easier.
02:30 SoniEx2 ShadowNinja, in C you just copy the memory and fix the pointers
02:30 VanessaE ok so luajit took the x86_64 stuff out of the path.
02:30 ShadowNinja VanessaE: So is it or isn't it?
02:31 ShadowNinja SoniEx2: Not with linked lists and similar structures.
02:31 VanessaE http://pastebin.ubuntu.com/7470932/
02:31 VanessaE ok so it looks like it IS consistent
02:31 VanessaE which makes this a LuaJIT problem.
02:32 SoniEx2 ShadowNinja, with linked lists you still copy memory and fix pointers
02:33 ShadowNinja VanessaE: You said you compiled LuaJIT, so check luaconf.h or the docs to add the needed paths.
02:33 SoniEx2 but you copy entry 1, then entry 2, then fix entry 1's pointer to entry 2, etc
02:33 SoniEx2 or something like that
02:33 SoniEx2 Lua tables are hash map + array
02:33 SoniEx2 so basically array + array
02:34 ShadowNinja SoniEx2: That isn't just a memcpy though.  C++ just affers copy constructors eince it supports OOP.
02:34 VanessaE ShadowNinja: checking.
02:34 ShadowNinja since*
02:34 ShadowNinja offers*
02:34 SoniEx2 where/when did I say "you just do a memcpy", tho?
02:34 SoniEx2 :P
02:36 ShadowNinja "in C you just copy the memory and fix pointers"
02:36 SoniEx2 I didn't say how
02:37 ShadowNinja And pointers are a relatively advanced concept.  But this is off-topic.
02:40 SoniEx2 so anything against a built-in simple yet powerful (and moddable) table copy function?
02:41 SoniEx2 other than the fact that you don't like it, that is...
02:41 SoniEx2 (and the fact that it's probably not gonna get included...)
02:42 ShadowNinja I'd support that.  I'll finish my implementation and provide a patch later.  But what about my *dump*() patch?
02:42 SoniEx2 it looks better
02:42 SoniEx2 I didn't go too deep into it tho
02:43 ShadowNinja SoniEx2: O.K.  good.  Anyone else?
02:43 ShadowNinja (I technically don't need approval for this, but I like to have comments for a patch li
02:44 ShadowNinja longer than a few dozen lines)
02:45 SoniEx2 heh I see what you did there
02:45 SoniEx2 you basically did the same thing I did
02:46 SoniEx2 the dump() is just like my deepcopy function
02:46 SoniEx2 except you use pairs and stuff
02:47 SoniEx2 I guess it's not supposed to handle metatables...
02:48 ShadowNinja Um, no.  It returns a human-readable representation of an object.
02:48 ShadowNinja It doesn't touch metatables yet.
02:49 SoniEx2 I know it does a dump and not a copy
02:49 SoniEx2 but it kinda does the same I do in terms of scanning the table and stuff...
02:49 ShadowNinja Unless you mean that it does the same thing that you did in your own project...
02:50 ShadowNinja The dumped/copied table usage is similar, yes.
02:51 SoniEx2 it just recursively calls itself with a recursion table to avoid infinite recursion
02:51 SoniEx2 but it also checks for the type and returns basic_dump(in) if it's not a table
02:52 SoniEx2 which's pretty much the same I do
02:52 SoniEx2 in a way
02:53 ShadowNinja Yes, it has it's similarities.
02:53 SoniEx2 it would look kinda funny if done with a copy function and metatables... but it would work...
02:54 SoniEx2 anyway, I'm tired
02:54 SoniEx2 good night
03:02 VanessaE ShadowNinja: had to change line 62 of luaconf.h to this:
03:02 VanessaE #define LUA_CPATH_DEFAULT       "./?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
03:03 VanessaE that makes it work again.
03:03 ShadowNinja :-)
03:03 VanessaE but editing luajit's source, even for a one-line change, feels wrong.
03:03 VanessaE and I see no clear way to add that extra atom from the command line
03:04 ShadowNinja VanessaE: Use the -D flag to gcc.
03:05 ShadowNinja And check if changing LUA_[RL]?CPATH%d?
03:05 VanessaE ShadowNinja: it's unclear which of these 47 bazillion variables is actually accessible from there.
03:05 ShadowNinja + would be more appropriate.
03:06 ShadowNinja I can't help much now though.  Maybe tomorow.
03:12 VanessaE I give up.
03:12 VanessaE I'll leave it like this, at least it runs.
03:24 kaeza joined #minetest-dev
03:55 Megaf joined #minetest-dev
04:24 crazyR joined #minetest-dev
04:40 Eater4 joined #minetest-dev
04:42 stormchaser3000 joined #minetest-dev
04:42 Eater4 joined #minetest-dev
05:11 RealBadAngel joined #minetest-dev
05:12 RealBadAngel hi
05:12 RealBadAngel anybody checked #1303 ?
05:12 ffoxin_work joined #minetest-dev
05:12 ShadowBot https://github.com/minetest/minetest/issues/1303 -- Unite nodes shaders. by RealBadAngel
05:14 RealBadAngel also i want to merger this code into misc_helpers.lua
05:14 RealBadAngel http://pastebin.com/xrM4nULS
05:14 RealBadAngel *merge
05:16 RealBadAngel handy way to check if function exists. it checks all elements of namespace for nil
05:16 RealBadAngel so no crash possible
05:43 SoniEx2 joined #minetest-dev
06:03 grrk-bzzt joined #minetest-dev
06:04 Mimilus_ joined #minetest-dev
06:44 CraigyDavi_ joined #minetest-dev
06:44 VargaD joined #minetest-dev
06:45 darkrose joined #minetest-dev
07:36 arjun joined #minetest-dev
08:07 CraigyDavi joined #minetest-dev
08:13 arjun joined #minetest-dev
08:36 restcoser joined #minetest-dev
08:49 jin_xi joined #minetest-dev
09:33 ImQ009 joined #minetest-dev
09:53 darkrose joined #minetest-dev
09:53 pro joined #minetest-dev
10:04 Jordach joined #minetest-dev
10:52 RealBadAngel so, #1305
10:52 ShadowBot https://github.com/minetest/minetest/issues/1305 -- Safe way to check if function of name given exists. by RealBadAngel
10:52 RealBadAngel any comments on that?
11:06 proller joined #minetest-dev
11:34 Megaf joined #minetest-dev
11:37 PenguinDad joined #minetest-dev
12:15 kahrl joined #minetest-dev
12:25 PilzAdam joined #minetest-dev
12:50 CraigyDavi_ joined #minetest-dev
13:07 hmmmm joined #minetest-dev
13:14 PenguinDad joined #minetest-dev
13:27 Mimilus joined #minetest-dev
13:33 ffoxin_work joined #minetest-dev
13:46 catninja joined #minetest-dev
13:46 lanxu joined #minetest-dev
13:49 Likeyn joined #minetest-dev
13:58 smoke_fumus joined #minetest-dev
14:01 CraigyDavi joined #minetest-dev
14:30 Piggybear87 joined #minetest-dev
14:33 Mimilus joined #minetest-dev
14:56 CraigyDavi joined #minetest-dev
15:10 Zeitgeist_ joined #minetest-dev
15:11 Exio4 joined #minetest-dev
15:20 zat joined #minetest-dev
15:49 ShadowNinja RealBadAngel: I use a function like resolve_name in a Lua IRC bot that I wrote, but "a" should be passable as a parameter.  And it needs a more descriptive name, like "cur".
15:50 ShadowNinja Also, globals are generally bad.
15:51 ShadowNinja And it needs documentation.
15:51 us`0gb joined #minetest-dev
15:53 ShadowNinja Also: t={x={["Hi.  :-)"]={f=function()end}}} print(function_exists("t.x['Hi. :-)'].f") won't work.
15:54 ShadowNinja Actually, "t.x.Hi. :-).f" would almost work.  The . Just needs an escape.
15:56 ShadowNinja Also, the use case for function_exists seems rare.  And it's simple to do if resolve_name is available.
15:57 ShadowNinja Normally I'd use > if t and t.x and t.x["Hi. :-)"] and t.x["Hi. :-)"].f then <...> end
16:00 PenguinDad joined #minetest-dev
16:01 grrk-bzzt joined #minetest-dev
16:01 ShadowNinja Much faster than parsing a string too.
16:04 SoniEx2 function_exists(something) = if x then if x.y then if x.y.z then <stuff> end end end?
16:04 SoniEx2 (and type(x.y.z)=="function"?)
16:06 ShadowNinja SoniEx2: Yes, but Lua does proper short-circuiting, so you only need one if statement.
16:18 CheapSeth joined #minetest-dev
16:30 sapier joined #minetest-dev
16:31 SoniEx2 ShadowNinja, uhh what do you mean?
16:31 dsimon if x and x.y and x.y.z
16:31 SoniEx2 oh that
16:32 dsimon lua will not try to evaluate anything to the right of an 'and' if the left is false
16:32 SoniEx2 yeah I forgot about that
16:32 SoniEx2 .-.
16:32 dsimon whoa, how did you put your mouth above your eyes?
16:32 SoniEx2 why does it need a function then?
16:32 dsimon that's a neat trick :-)
16:33 dsimon though i'd worry about my face getting stuck
16:33 dsimon hm, but the ideal would be if we could get a ruby-like 'try' function
16:34 SoniEx2 we have pcall
16:34 sapier http://pastebin.com/xrM4nULS RBA what exactly does this do?
16:35 SoniEx2 select(2,pcall("return type(x.y.z.a.b.c.etc) == "function" and x.y.z.a.b.c.etc"))
16:35 SoniEx2 uhh wait
16:35 SoniEx2 that would return false, errmsg on error...
16:35 SoniEx2 select(3,pcall("return nil, type(x.y.z.a.b.c.etc) == "function" and x.y.z.a.b.c.etc"))
16:35 SoniEx2 :3
16:35 SoniEx2 (cheap hax ftw)
16:36 SoniEx2 nil on error, or the function if it exists
16:36 sapier RealBadAngel: hope it's not possible to get any function within lua stack that easy
16:39 SoniEx2 uhh wait that shouldn't be a string... .-.
16:39 SoniEx2 here: https://github.com/minetest/minetest/pull/1305#issuecomment-43352559
16:42 sapier still SoniEx2 noone did answer xyzz's question by now
16:42 Megaf joined #minetest-dev
16:43 SoniEx2 sapier, how about groovy?
16:43 sapier not a valid reason for a merge ;-P
16:43 SoniEx2 http://groovy.codehaus.org/Null+Object+Pattern
16:44 SoniEx2 let me quote it
16:44 SoniEx2 "Secondly, with the ?. operator, an expression like p?.job?.salary will be equal to null if salary is equal to null, or if job is equal to null or if p is equal to null. You don't need to code a complex nested if ... then ... else to avoid a NullPointerException."
16:44 SoniEx2 uhh that was longer than I expected...
16:44 sapier I don't want a theory lesson but a practical example
16:44 SoniEx2 well
16:44 sapier theory is good but most time quite useless
16:45 SoniEx2 you don't need an if then else chain
16:45 sapier I can't tell how much code I've seen to theoreticaly work but fail terribly for it's real usecase
16:45 SoniEx2 or if x and x.y and x.y.z and x.y.z.a and x.y.z.a.b and x.y.z.a.b.c and x.y.z.a.b.c.etc then ... end
16:46 Jordach joined #minetest-dev
16:46 sapier still for what I read this code I'd not be sure if  a function halled 123456789 wouldn't make function_exists(456) tell true
16:47 SoniEx2 yeah it should use pcall and loadstring
16:48 sapier why?
16:48 SoniEx2 because pcall and loadstring would support x[y] and stuff
16:48 sapier still it's called "function_exists" not "tryecute"
16:48 sapier +x
16:48 VanessaE RBA's idea arose from a sanity check I had to add to plants_lib yesterday
16:49 SoniEx2 the code only supports x.y.z.etc
16:49 sapier ok what do you check vanessae maybe I understand better once I know what this is used for
16:49 SoniEx2 you can't use objects as indexes
16:49 VanessaE he thought a more generic solution to the problem I had to solve might be a good idea for the future.
16:50 SoniEx2 my code lets you do x.y.z.etc, x[y][z][etc], x(y).z.etc
16:50 SoniEx2 and all that
16:51 VanessaE sapier: well in plants_lib, in one of its API calls, you can pass a field that contains either a node name, a function name, or a table (L-system), but the program has to check if that string points to a valid  function if it doesn't appear to be a node and isn't a table
16:51 ImQ009 joined #minetest-dev
16:51 sapier well to me "resolve_name" means "get ip address for dns name" ... and function_exists(name) I'd expect me to tell if a function called exactly name exists ... but that'd be way more easy by if name ~= nil and type(name) == "function" then
16:51 VanessaE the function name is passed as a string containing the name
16:52 sapier why do you pass it as string?
16:52 VanessaE I eventually solved it in a simpler way:  https://github.com/VanessaE/plantlife/blob/master/plants_lib/init.lua#L186
16:52 SoniEx2 VanessaE, select(3,pcall(loadstring("return nil, type(x.y.z.a.b.c.etc) == \"function\" and x.y.z.a.b.c.etc end")))
16:52 VanessaE sapier: old code.
16:52 VanessaE sapier: when it was written, I didn't know how to properly pass actual functions back and forth, and now that part of the API is sorta set in stone.
16:53 sapier that's really hacky ;-) why don't you clean it up ? ;-)
16:53 VanessaE SoniEx2: not too different from that.
16:53 VanessaE sapier: you wanna rewrite the other mods that use that feature? :)
16:53 dsimon you could make it type-sensitive for backwards compatibility
16:53 VanessaE dsimon: I could, but I'm lazy :P
16:53 sapier I'd add a big fat warning and remove it in about half a year
16:54 SoniEx2 ^
16:54 VanessaE anyway, the above is how I solved it, similar to SoniEx2's idea.
16:54 VanessaE RBA's idea might be useful in some rare corner cases too
16:55 sapier well I'm not against the feature although I believe the intention to be wrong, but the naming of those functions is quitr missleading to me
16:55 SoniEx2 VanessaE, your thing does too many loadstrings...
16:55 VanessaE SoniEx2: I know.
16:56 SoniEx2 so mine is better :P
16:56 SoniEx2 (well almost)
16:56 rubenwardy joined #minetest-dev
16:58 VanessaE the sanity check, fwiw, came about in a weird way:
16:58 VanessaE the check for a *node name* failed in one case because the node being called for was undefined
16:58 VanessaE so it fell through with the assumption that it's a function :P
17:11 cerulean256 joined #minetest-dev
17:22 Calinou joined #minetest-dev
17:31 RealBadAngel hey
17:32 VanessaE hi
17:33 RealBadAngel to get why the code checks namespace part by part try to run: print(type(minetest1.swap_node))
17:36 RealBadAngel and idea for that is easy way to configure your mods, just by checking if something exists, which is kinda opposite to publish features
17:36 sapier RealBadAngel: I'm to lazy to do that now I guess what you wanna tell is it does really look for an exact match?
17:36 RealBadAngel it checks each part of a.b.c.d.etc for nil
17:37 RealBadAngel so it wont crash
17:37 RealBadAngel example above will crash
17:38 RealBadAngel ofc each mod could write a hax to check for functions, but i wanted a generic way, provided by engine
17:38 sapier well while that feature could be usefull for some mods I'd see this more in some sort of support library then in builtin ... hmm we don't have something like that maybe we should create one
17:38 RealBadAngel could be usefull? its necesary
17:38 sapier especially as I expect "some" to be more "a few" then "a lot"
17:39 sapier we've got exactly one usecase by now and I'm not even sure this is a really valid one
17:39 RealBadAngel i can then easily configure my mods to work with all the engine versions out there
17:39 sapier no you can't
17:39 sapier well you shouldn't
17:40 sapier basically for same reason once the feature flags have been added ... ok noone uses them true
17:40 RealBadAngel thats example
17:41 RealBadAngel another example, im using mesecons. but i want specific function from it and i want to be sure that is aviable
17:42 sapier well anyway as function_exists seems to do what it's called it might be fine, but I suggest asking some ppl what they'd expect resolve_name to do because I'd expect it to do something completely different
17:42 Anchakor joined #minetest-dev
17:43 RealBadAngel resolve name just checks  a then b then c until last part, function name
17:43 RealBadAngel and btw, parameter is function_name, not example usage of function
17:43 sapier well "resolve_name" is somehow connected to dns names
17:44 VanessaE test_function_name ?
17:44 sapier at least to me, that's why I suggest asking other people what they'd expect a function called this way to do (without telling them what it does first)
17:45 RealBadAngel it should be made local
17:45 RealBadAngel its in fact internal thingy for function_exists
17:45 sapier in this case the name would be almost irrelevant
17:46 sapier but as ppl tend to remove local from functions they consider usefull I'd still prefere it to have a more specific name. But of course that's a personal opinion
17:47 RealBadAngel any ideas for name?
17:47 VanessaE [05-16 13:44] <VanessaE> test_function_name ?
17:48 sapier #1241 if noone knows about problems this adds I'm gonna merge it tonight (in about 4-5h)
17:48 ShadowBot https://github.com/minetest/minetest/issues/1241 -- Add formspec toolkit and refactor mainmenu to use it by sapier
18:01 nore joined #minetest-dev
18:03 CraigyDavi_ joined #minetest-dev
18:07 CraigyDavi__ joined #minetest-dev
18:08 khonkhortisan joined #minetest-dev
18:08 VanessaE ~tell sapier [05-16 14:06] <Jordach> http://www.theregister.co.uk/2014/05/16/boffins_run_ios_apps_on_android_hardware/
18:08 ShadowBot VanessaE: O.K.
18:09 sfan5 VanessaE: how is this relevant for android stuff?
18:10 CraigyDavi joined #minetest-dev
18:12 VanessaE sfan5: it may be helpful in developing an iOS port of minetest, as sapier lacks any iOS devices, as I recall.
18:12 sfan5 I have an iOS device
18:12 VanessaE oh ok,
18:13 VanessaE well since he's been kinda at the forefront of it, that's why I figured he'd be interested.
18:13 sfan5 ah
18:14 sfan5 VanessaE: I even did some iOS stuff, but the non-portable way: https://github.com/sfan5/minetest/tree/ios
18:16 VanessaE non-portable? O_o
18:16 VanessaE (given the target platform, that comment confuses me a bit :) )
18:16 sfan5 s/portable/cmake/
18:16 VanessaE ah
18:36 EvergreenTree joined #minetest-dev
18:38 nore joined #minetest-dev
18:51 RealBadAngel one handy thing for testing (waiting for comments)
18:51 RealBadAngel http://pastebin.com/6tiLfaSu
18:52 RealBadAngel make a mod out of it (paste it into empty init.lua)
18:53 RealBadAngel it replaces built it item behaviour
18:53 RealBadAngel so items on the ground do stack themselves when hit the ground
18:54 VanessaE ^^^^^ I tested the above, it works quite nicely.
18:56 RealBadAngel *built in
18:57 Jordach_ joined #minetest-dev
19:13 khonkhortisan joined #minetest-dev
19:17 RealBadAngel anybody else tested it?
20:01 PenguinDad RealBadAngel: animated water is broken with #1303 http://www.directupload.net/file/d/3624/x6nz7iss_png.htm
20:01 ShadowBot https://github.com/minetest/minetest/issues/1303 -- Unite nodes shaders. by RealBadAngel
20:01 kaeza joined #minetest-dev
20:07 tomreyn joined #minetest-dev
20:17 cerulean256 quick question.. I am trying to use the on_punch callback and would like to access the original entity from within the call back...
20:17 cerulean256 obj:get_luaentity().on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir) blah blah blah
20:18 cerulean256 maybe I am misunderstanding.. but isn't the self parameter a reference back to the luaentity?
20:19 cerulean256 it's described in a little more detail here: http://dev.minetest.net/LuaEntitySAO
20:20 cerulean256 an example would help a lot :)
20:21 PenguinDad cerulean256: write obj:get_luaentity():on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir) --some code end
20:22 PenguinDad s/write/try/
20:22 cerulean256 only difference being the ':'
20:23 cerulean256 ok.. I'll see if that's the cause.. now you mention it... it makes sense
20:23 kaeza wat
20:24 kaeza PenguinDad, that's invalid syntax (you can only use ':' to *call* functions)
20:25 kaeza like obj:func(), but you cannot do obj:field = foo
20:25 cerulean256 ok.. that didn't work
20:25 PenguinDad kaeza: https://github.com/PilzAdam/carts/blob/master/init.lua#L24
20:25 cerulean256 using the . works
20:26 cerulean256 I just made a test to send a chat message when I punch my entity
20:26 cerulean256 but I want to be able to manipulate the entity that is being punched.. so I need access to the luaentity from within the punch func
20:27 cerulean256 and all I get are nils
20:27 kaeza PenguinDad, function foo:bar(...) is syntactic sugar for foo.bar = function(self, ...), so my comment still applies
20:29 kaeza cerulean256, can you pastebin a little bit of code?
20:29 cerulean256 sure
20:29 kaeza also, can we take this to #minetest-mods / #minetest ?
20:30 cerulean256 sure
20:37 werwerwer_ joined #minetest-dev
20:43 sapier joined #minetest-dev
20:48 tomreyn joined #minetest-dev
20:50 SoniEx2 a set node event should be added
20:51 alexxs joined #minetest-dev
20:51 SoniEx2 and place node, break node, etc
20:52 kaeza there's register_on_(dig|place)node
20:58 paramat joined #minetest-dev
21:00 SoniEx2 kaeza, what about worldgen etc?
21:01 kaeza for that, on_generated/ABMs
21:07 Jordach_ joined #minetest-dev
21:08 sapier ShadowNinja: you tapped in the "kill" trap ;-)
21:18 SoniEx2 kaeza, so register_on_generated?
21:18 kaeza yep
21:18 SoniEx2 how do you use it?
21:19 kaeza ask paramat :)
21:19 SoniEx2 uhh wait...
21:20 sapier I'm gonna merge 1241 in about half an hour if there are no issues about those things I changed
21:20 Jordach joined #minetest-dev
21:28 VanessaE kaeza: he's talking about some kind of callback that could be used to detect when something called by on_generated adds a node to the map
21:31 kaeza adding such a callback would undermine the huge speeds you get from VManips, or make Lua-based generation even slower in the general case
21:31 kaeza or dunno
21:31 sapier that'd be basically a first grade performance killer
21:31 sapier any changed node no matter who changes it will call that callback
21:32 sapier abms switching nodes, lua mapgens ... and and and
21:34 blaise joined #minetest-dev
21:35 kaeza SoniEx2, what is your goal? i.e. what do you need the callback for?
21:39 paramat celeron55, please can we have an option to make "air" do drowning damage? im currently using 'airlike' vacuum nodes which have problems
21:43 sapier pushing #1241 now
21:43 ShadowBot https://github.com/minetest/minetest/issues/1241 -- Add formspec toolkit and refactor mainmenu to use it by sapier
21:43 SoniEx2 kaeza, ask VanessaE :P
21:43 SoniEx2 VanessaE, I'm a they .-.
21:45 VanessaE ehm, ok
21:47 VanessaE kaeza: the gaol, or rather the theory, is that plants_lib could be sped up somewhat if I could evaluate the mapblock for surfaces just once, and then just populate the result, instead of having to run through the entire evaluator for every single node type that's being added ( https://github.com/VanessaE/plantlife/blob/master/plants_lib/init.lua#L119 )
21:48 VanessaE problem is, I can scan for surfaces, but it's impossible to know that, for example, a big tree was grown over here, or a chunk of the map was just erased over there by one of the mods that hooks into my mapgen code
21:48 VanessaE so I have no choice but to run through that entire search_for_surfaces() call (I know the name is misleading) for every place that hooks in.
21:49 VanessaE for Dreambuilder, I counted 120 such hooks, but I am not sure how many are duplicates (I'd guess about half)
21:49 VanessaE s/gaol/goal/
21:53 sapier vanessae could you check #1297 is fixed for you too?
21:53 ShadowBot https://github.com/minetest/minetest/issues/1297 -- Public serverlist failure
21:54 VanessaE sapier: it's fixed, but check the Settings menu npow
21:54 VanessaE now*
21:54 VanessaE grey backgrounds behind the options, is this intentional?
21:54 VanessaE also, btw, the brown background is fixed as well
21:55 VanessaE http://digitalaudioconcepts.com/vanessa/hobbies/minetest/screenshots/Screenshot%20-%2005162014%20-%2005%3a55%3a36%20PM.png
21:55 VanessaE is this intentional?
21:56 sapier yes the grey background is intentionally
21:56 VanessaE ok, but do note how the words overflow it.
21:57 VanessaE this looks... eh..  well not good :P
21:57 sapier yes that's caused by your font
21:57 VanessaE that's not "my font" :P  that's just my having turned the default size up so mybad eyes can read it
21:57 sapier the texts overflow follow up checkbox too so this isn't a issue of the boxes but a generic issue about text lengths
21:58 VanessaE right.  may I suggest some sort of clipping be added?  or better, abbreviate the text when it overflows
21:58 sapier well worldcraft added a feature to make formspecs scale related to fontsize
21:58 sapier that'd be usefull for hdpi screens too
21:58 VanessaE Preload Item visuals --> Preload ite...
21:59 VanessaE could be useful perhaps, yeah
22:00 VanessaE though my screens' DPI is about average, 96 I guess.  I just have bad eyes.
22:00 VanessaE anyway, it all seems to work fine now.
22:00 sapier well high dpi screens are another reason where that feature is usefull ... additional to bad eyes ;-)
22:01 sapier it's rare but sometimes you can fix two issues with one feature ;-)
22:08 VanessaE heh
22:14 Megaf joined #minetest-dev
22:22 grrk-bzzt joined #minetest-dev
22:28 SoniEx2 RealBadAngel, 1. https://github.com/minetest/minetest/pull/1305#issuecomment-43383141 2. your code doesn't like t[x] and stuff
22:35 stormchaser3000 joined #minetest-dev
22:35 SmugLeaf joined #minetest-dev
22:35 robmyers joined #minetest-dev
22:35 VanessaE joined #minetest-dev
22:35 book` joined #minetest-dev
22:35 hax404 joined #minetest-dev
22:38 ImQ009 joined #minetest-dev
22:56 ImQ009 joined #minetest-dev
22:58 cerulean256 I'm running into an issue...
22:59 cerulean256 I just built minetest from latest git and started with a clean configuration.
22:59 sapier what happened?
23:00 cerulean256 when I enable the public server list in the clients tab... I get a lua error on line 911
23:00 sapier you did clone right now true?
23:00 cerulean256 'attempt to get length of field 'favorites' (a nil value)
23:00 cerulean256 yes
23:01 sapier can you post the full message?
23:01 cerulean256 0.4.9-228-g34d8726
23:01 cerulean256 sure.
23:02 sapier wait
23:02 cerulean256 ERROR: /usr/share/minetest/builtin/mainmenu/init.lus:911: attempt to get length of field 'favorites' (a nil value)
23:02 sapier g34? ... you missed the latest commit which fixes that issue
23:02 cerulean256 ah.. ok
23:02 cerulean256 will refetch
23:03 cerulean256 ok.. compiling ... again
23:04 cerulean256 looking in that file it seems someone should make up their mind on how to spell the word favorite
23:04 cerulean256 either british or american english... but mixing is bound to screw something up down the road ;)
23:05 sapier well that's most likely me ... once english and us ppl agree to a single word us non native ones may get it right too ;-)
23:06 cerulean256 I'd try to shoot for consistency... that's all
23:06 cerulean256 I use american english... but if the original author used british.. I would adjust
23:07 sapier hmm I don't know about any englishmen in here but a lot of us ppl but on the other hand usually you learn british english in other countrys
23:07 cerulean256 sure, but you get my point right?
23:07 sapier but for the main reason I agree to consistency should be the goal yes
23:08 cerulean256 and this one can be corrected easily with a regex.
23:08 sapier well last time I used a regex to replace a thing I got punched for making minetest to selfish ;-)
23:09 sapier but I wont stop you from doing it and create a pull request for sure ;-)
23:09 cerulean256 that's ridiculous... if it achieves consistency it's a service and not selfish at all.
23:10 sapier well cerulean256 "selfish" isn't meant the way it's usually meant in this case ;-)
23:10 sapier small explanation ... I had to replace this by self ... ;-)
23:10 * cerulean256 thinks sapier has been punching too many nodes
23:11 cerulean256 :)
23:11 cerulean256 ok.. my build is done
23:11 cerulean256 lets see if this is really fixed
23:11 PenguinDad cerulean256: "self program is distributed" in the license for example
23:12 sapier btw I hope someone did crosscheck I didn't miss to revert any of the accidental replacements ;-)
23:14 cerulean256 another observation.... when I am in the server tab and typing in credentials to login to a server.. I usually press tab to go to the next field
23:14 cerulean256 in this case... it exits minetest
23:15 sapier hmm couldn't you have told this about an hour before? ;-)
23:15 cerulean256 :p
23:15 PenguinDad did anyone else notice that gui_scaling doesn't work in mainmenu anymore?
23:15 sapier no because it's not supposed to work in mainmenu ;-P
23:16 PenguinDad it worked earlier :/
23:16 blaise joined #minetest-dev
23:16 sapier what exactly do you want to scale?
23:17 VanessaE <PenguinDad> the whole menu?
23:17 VanessaE ;)
23:18 sapier well define "earilier" ;-) because it doesn't scale for the pre cleanup version too
23:19 cerulean256 well one thing is for sure.. the background stretching works...
23:20 sapier that one is supposed to be stretched but not the menu itself
23:20 cerulean256 i wonder if you can force it to maintain the aspect ratio.
23:20 sapier not yet
23:21 sapier buttons as well as text wouldn't scale only the empty room around ... that's not really usefull
23:21 cerulean256 agreed
23:22 cerulean256 besides..I'd rather see the background artwork of mods instead
23:22 sapier of which mod? there could be plenty of mods
23:23 cerulean256 I meant games
23:23 sapier they are shown
23:23 cerulean256 i know.. and I like that :)
23:23 sapier ohhh :-) now I understand

| Channels | #minetest-dev index | Today | | Google Search | Plaintext