00:01 g0bl1n
00:01 serianox
00:11 sebi_` sebi`
00:13 SmithKurosaki #lua
00:13 ToxicFrog #lua
00:16 TheBunny
00:16 Firzen
00:19 Kumool
00:20 lhf #lua
00:22 sylvanaar_work #lua
00:22 sylvanaar_atwork
00:24 Kumool #lua
00:27 mattikus
00:30 {newbie}
00:41 gershon
00:44 THC4k #lua
00:45 Funkeh`
00:46 Kilroo #lua
00:53 cortana`
00:55 Kumool
00:57 jugg #lua
01:01 Slade-
01:01 stuckie
01:02 stuckie #lua
01:05 Kumool #lua
01:18 aliverius
01:19 DrToast #lua
  DrToast #lua
01:19 aliverius #lua
01:38 rafaelmartins
01:41 rafaelmartins #lua
01:46 THC4k
01:55 sebi_` #lua
01:56 aliverius
01:58 sebi`
02:13 Frakenstein #lua
02:24 nighty__ #lua
02:26 LaKraven
02:27 TobiasFar #lua
02:32 lhf
02:37 nighty__
02:51 Baatti #lua
02:53 jcowan #lua
02:58 Slade- #lua
02:58 Emzzzz #lua
02:58 Emzzzz http://imggmi.info/DSC-1268362369.jpg/ do my tits look big?
02:58 Emzzzz #lua
03:15 seisatsu
03:18 jcowan_ #lua
  jcowan_ #lua
03:24 pjm0616
03:30 Legorol
03:33 seisatsu #lua
03:39 ivan`
03:49 jugg follow up on tokenizing a string into quoted parameters: http://codepad.org/Yawzh009 feel free to comment, offer suggestions. (note: it doesn't handle escaped quotes, I don't have that requirement)
03:51 pjm0616 #lua
03:52 ivan` #lua
03:55 TheBunny #lua
04:02 CcSsNET #lua
04:03 Baatti
  Baatti #lua
  Baatti
04:04 Baatti #lua
04:06 malinka
04:08 Baatti Baatti_AFK
04:13 malinka #lua
04:22 malinka
04:26 malinka #lua
04:28 MizardX
04:34 weigon_ #lua
04:38 weigon
04:43 deryni jugg: You can get rid of the :match call if you just try the first gsub and check the count of replacements it does, but I don't know if that's going to be better or worse performance wise.
04:44 deryni Also, I'd use :gsub and avoid table.insert (just append it manually, either with #tokens+1 or keep a count).
04:56 MattJ
05:00 jugg I can't base it on whether the first gsub call matches or not, as it may fail to match, yet still start with a ".
05:01 jcowan #lua
05:03 deryni In which case you want what to happen?
05:04 jugg the block that if param == old then handles.
05:05 Kumool
05:05 malinka
05:05 jugg ie, if neither of the patterns apply, then the string format is bad, and it should just return the rest of the string as a single token.
05:06 deryni Right, that works fine with what I said.
05:07 deryni Hm, at least I think it does. Let me test it.
05:07 jugg except in your case, it also applies the second gsub reducing performance.
05:07 deryni Potentially, it depends on how quickly gsub short-circuits as compared to match.
05:10 jugg ok, how's this: http://codepad.org/Yo27DFpx
05:12 deryni Other than that c is a global it looks fine to me. But like I said using match may be faster, it depends on tight timing and what your input looks like (if you rarely hit the one gsub case this way likely isn't better).
05:15 jugg oops, neither way works if there is leading whitespace.
05:16 deryni I fixed that, hold on.
05:17 deryni I used '^([^%s]*)%s*' for the second pattern.
05:19 pdusen
05:20 deryni That grabs the initial space as an entry and should be what you want assuming [[foo"bar"]] is one token and not two.
05:22 malinka #lua
05:23 sylvanaar_work
  sylvanaar_work #lua
05:25 Kumool #lua
05:32 dark
05:39 jugg well, I think this is my final version for now: http://codepad.org/RkkYEgdX thanks for your input deryni
05:42 deryni If that suits your needs, great. Personally I find splitting [["am I a "token" yes?"]] into 'am I a ', 'token', and ' yes?' very odd.
05:46 Poison[BLX] #lua
05:48 jugg well, the alternative is: am I a , token" , yes?"
05:49 jugg or, I have to require a space after the closing " to avoid that. But that requires alternation to check for a space or end of string $
05:49 deryni You can post-process that I think, if your final non-match is "......" strip them.
05:50 deryni But yeah, like I said, it depends on what your requirements are.
05:51 blankthemuffin #lua
05:51 jugg yah, I think it is doing what I need.
05:53 malinka
05:54 jugg if a space is required after a quote, then the result of that input would be: am I a "token , yes?"
05:56 jugg hmm, actually it wouldn't produce a match at all... so it'd just return the whole string.
05:56 anthonyl
06:00 TR2N #lua
06:07 malinka #lua
06:07 dvx #lua
06:07 jA_cOp #lua
06:16 Poison[BLX]
06:20 General1337 #lua
06:21 blankthemuffin
06:22 Kilroo
06:23 sylvanaar_work
  sylvanaar_work #lua
06:24 General13372
06:25 Luben
06:26 Luben #lua
06:44 seisatsu
06:45 seisatsu #lua
06:47 Zaba
06:55 Zaba #lua
06:55 ikaros #lua
07:15 foodoo #lua
07:19 nighty__ #lua
07:19 daurnimator jugg: the whole process seems strange
07:20 daurnimator only place I can see it making sense is emulating some sort of command line arguments...
07:21 blankthemuffin #lua
07:32 General1337
  General1337 #lua
07:32 inigo #lua
07:36 m1ndwarp #lua
07:39 nighty__
07:46 MaNI2 #lua
07:47 MaNI2 #lua
07:52 ikaros
07:53 THC4k #lua
07:54 snogglethorpe #lua
07:55 Blub\0
08:06 Gruni #lua
08:06 Burga #lua
08:18 Textmode #lua
08:19 Textmode morning all
08:19 serianox #lua
08:20 Juizmode #lua
08:22 m1ndwarp
08:41 noisetonepause #lua
08:42 kwinz3
08:42 Firzen #lua
08:46 hoelzro #lua
08:50 vycdin #lua
08:52 hoelzro
08:56 sylvanaar_work
08:57 polemon
09:00 noisetonepause
09:14 weigon_ weigon
09:18 {newbie} #lua
09:27 Blub\0 #lua
09:30 Blub\0
09:33 Baatti_AFK Baatti
09:33 Blub\0 #lua
09:43 jcowan #lua
09:44 kwinz3 #lua
09:46 g0bl1n #lua
09:54 Gruni
09:55 bluenovember #lua
09:58 Gruni #lua
10:04 erikc #lua
10:05 snogglethorpe
10:10 Moose
  Moose #lua
10:11 curtana #lua
10:17 Kamehame #lua
10:19 Kamehame where can i learn the lua?
10:19 Textmode does anyone know of a minimal-fuss UI kit based on SDL? Preferably lightweight?
    ??lua tutorial
10:19 Kamehame yes a tutorial
10:19 Textmode ?+Lua Tutorial: http://lua-users.org/wiki/TutorialDirectory
10:19 Juizmode Textmode: Added page 'Lua Tutorial[1]'
10:19 Baatti I'd suggest downloading the interactive one straight from lua.org
10:20 Baatti its a great interactive crash corse to get you started
10:20 Textmode Baatti: wheres that?
10:20 haste PiL is also a good start
10:20 Baatti one sec, I'll link it
10:21 Kamehame Is what I can find a tutorial in French?
10:21 Textmode ?+Programming in Lua: http://www.inf.puc-rio.br/~roberto/pil2/
10:21 Juizmode Textmode: Added page 'Programming in Lua[1]'
10:21 erus` #lua
10:23 Kamehame it'sn't in french
10:23 Baatti hrmm, I can't seem to find it now... I remember when I downloaded lua from lua.org, it came with an interactive tutorial on the basic syntax/semantics...
    I also should point out it was a windows binary download
10:24 kgermer #lua
10:25 Baatti yes, I just downloaded it and installed it again in windows... upon completion of installation, you are given the option to run an 'introduction'... which is a bit of an interactive tutorial
10:26 Kamehame i don't find the page for download the lua tutorial
10:27 Legorol #lua
10:27 Textmode Kamehame: he just said its intergrated with the windows installer.
10:27 Baatti hrm, Kamehame are you using windows?
10:27 Textmode regardless, I just learnt it from the refman :P
10:27 Kamehame yes, i use windows
10:27 PoppaVic The refman is well written.. The PiL is a fine adjunct - dated or not.
10:28 Baatti yes, I'd really suggest the documentation they've suggested already, this tutorial I speak of is ... well, rather simple
    http://luaforwindows.luaforge.net/
    that's to download the windows binary
10:28 Blub\0
10:30 Baatti hrm, so this 'introduction' is not what I recall
    this one just displays examples/explanations while you press enter to progress...
10:31 Baatti the other had you actually type in the examples
10:31 noisetonepause #lua
10:32 Textmode Kamehame: if nothing else, the channel is here to help :)
10:32 Baatti aye
10:32 m1ndwarp #lua
10:34 Kamehame i read the 4 first example and i think it looks like php
10:34 Baatti yes, its quite similar in many ways
10:35 Baatti I prefer lua though
    with lua you can rule the world
10:36 Kamehame =D
    i don't understand the 5 example
10:38 m1ndwarp
10:39 kwinz3
10:39 Baatti ex.5 is explaining that you should NEVER create variables with a leading: _
10:39 Kamehame ok
10:39 Baatti lua uses variables like _G and _VERSION
10:39 m1ndwarp #lua
  m1ndwarp
10:39 Baatti those variables are very important and should never be touched, unless you really know what you're doing
10:40 Kamehame like in php : $_SESSION, $_POST, $_GET...
10:40 sim2409_ #lua
10:42 Kamehame i don't understand the example 7
    i can't use the word write
    that i understand
10:43 Kamehame but i don't unsderstand the trick with and
10:43 Baatti AND is a keyword, but 'and' is one that you can use for a variable...
    lua is case-sensitive
10:44 Baatti THIS = 1 this = 2
    oops
    I said that backwards
    'and' is a keyword, 'AND' is not a keyword
10:44 Kamehame ok
10:45 Kamehame i think understand
10:45 Baatti everything in lua is either: variable, function, or value
    or keyword
10:45 Kamehame like in php ^^
10:46 Kamehame what is it : a= [[ blablabla ]]
10:46 Baatti hey, can't lua_bot execute basic script?
10:47 Kamehame i don't understand your question
10:47 Baatti kamehame, ignore my question
10:47 Kamehame ok
10:47 Baatti lua_bot, commands
    !commands
    hrmm
10:48 Textmode Baatti: yes, it can.
10:48 blankthemuffin !lua print("hello")
10:48 batbot blankthemuffin: hello
10:48 Baatti ahah, thanks
10:48 blankthemuffin lua> print("hello")
    > print("hello")
10:48 lua_bot blankthemuffin: hello
    blankthemuffin: hello
10:48 Baatti ! lua print("Hello world!")
10:48 Textmode > for i=1,3 do print("hello number" .. i) end
10:48 lua_bot Textmode: hello number1, hello number2, hello number3
10:49 Blub\0 #lua
10:49 Baatti > print("hello world!")
10:49 lua_bot Baatti: hello world!
10:49 Baatti thank you
10:50 Kamehame what is it for the "!" and the ">" early
10:50 Textmode Kamehame: he was testing luabot.
10:50 Kamehame in this channel or in lua language
10:51 Baatti both
10:51 Kamehame ok
    > print('hello lua_bot');
10:51 lua_bot Kamehame: hello lua_bot
10:51 Kamehame =D
10:52 kwinz3 #lua
10:52 Kamehame when i write my code i must write ">" before my line??
10:52 Kinnison Please, if you're not demonstrating something specific, DO NOT use lua_bot in-channel
10:52 Baatti Kamehame, only in here to use lua_bot
10:53 Kamehame ok
    so, i don't write the ">" before my line
10:54 Baatti no
    foo = 'bar'
    that is lua
10:55 Kamehame Is this a comment like this: [[ ... ]] ??
10:55 Baatti no, [[ ... ]] means 'pay attention to white-space'
10:56 Baatti lua ignores white space unless its inside " ", ' ', or [[ ]]
10:56 Kamehame ok
10:56 Baatti err, [[ ]] actually is used for multi-line
    :( I suck at explaining don't I?
10:56 sim2409_
10:57 Kinnison Kamehame: [[ ]] is for "long strings"
    Kamehame: long strings may contain newlines
10:57 {newbie}
10:57 inigo
10:57 Kamehame ok
10:57 Kinnison Kamehame: comments are preceeded by -- and last to the end of the line
10:57 inigo #lua
10:58 Kinnison Kamehame: You can, however, combine comments and long-string markers to easily comment out large blocks of text
10:58 Kamehame when i can write my lua code, in notepad++??
10:58 Kinnison e.g.
    --[[
    stuff
    more stuff
    this is all comments
    ]]
10:58 Toast_ #lua
10:58 Kinnison Kamehame: any plain text editor will do. Notepad, Notepad++, Zeus, PFE, etc.
10:59 Kamehame ok
    what does it mean stuff
11:00 Kinnison That's just me putting random text to indicate it is a comment
11:00 DrToast
11:00 Kamehame how to execute the lua
11:01 Kinnison Have you acquired a Lua interpreter for your computer?
11:01 Kamehame no
11:01 Kinnison I assume you're using Windows, so if not, search the web for "LuaBinaries" which is a project which products them.
11:03 Baatti to my knowlege Kamehame did download the lua 5.1 intepreter for windows
11:03 kgermer kamehame, try geany (editor, cross-plattform with syntax highlightning)
    notepad sucks
11:08 Textmode kgermer: geany might be overkill, though. lua lends itself well to lightweight editers if find. but yes, geany should work.
    anything that gives you lua highlighting should be a goer.
11:12 Kamehame i don't understand the example 11
11:14 {newbie} #lua
11:17 TobiasFar
11:17 Baatti
11:21 sylvanaar_atwork #lua
11:25 Kinnison What about it do you not understand? Also can you provide a URL to the example you're having trouble with?
11:26 TobiasFar #lua
11:26 Kamehame is not in web is a porgramme
11:26 Kinnison then use http://codepad.org/?lang=Lua to paste the example for us
11:26 Kamehame http://luaforwindows.luaforge.net/
11:28 Kamehame http://pastebin.com/wqQPuJrz
11:29 Kinnison That's example 18, not example 11
    is it this one you're stuck on?
11:30 Kamehame a yes i don't refind the 11
11:32 Kinnison Okay, so what is the first bit which confuses you?
11:33 Kamehame it does not matter
11:39 Baatti #lua
11:42 aliverius #lua
11:44 Textmode Kamehame: huh?
11:44 Kamehame ??
11:44 Juizmode [1/1]: This sucks
11:44 curtana
11:44 Textmode ..? lol
11:46 Baatti
11:46 Textmode pets Juizmode
11:47 Textmode Kamehame: how does it not matter? do you mean to say you don't understand any of it?
11:48 Kamehame i don't understand the example 11 but it does ot matter
11:51 gershon #lua
11:53 kwinz3
11:58 dvx
11:58 curtana #lua
11:59 {newbie}
12:01 Kamehame Is there a site like phpmanual but for lua
12:04 Textmode ??Lua Reference Manual
12:04 Juizmode Lua Reference Manual[1/1]: http://www.lua.org/manual/5.1/
12:04 Kamehame maybe
12:06 Kamehame is in portugé , en espagnol... but not in french =S
12:06 Funkeh` #lua
12:07 Textmode also russian and hungarian, apprently...
12:07 kwinz3 #lua
12:08 dvx #lua
12:17 blankthemuffin
12:21 odomobo_ #lua
12:21 Gruni
12:24 odomobo
12:26 General13372 #lua
12:27 erus`
12:29 General1337
12:33 daedeloth #lua
12:36 Kamehame
12:39 erus` #lua
12:40 aliverius_ #lua
12:40 Kamehame #lua
12:41 aliverius
12:41 Kamehame reapeat ... until is such that while do end??
12:43 MattJ #lua
12:49 Kinnison no
    while CONDITION do BLOCK end
    repeat BLOCK until CONDITION
    the former checks first
    the latter checks last
12:50 Kamehame is such
12:50 Kinnison the former repeats while CONDITION is true
    the latter repeats until CONDITION is true
    so they have opposite senses too
13:02 dvx
13:17 LaKraven #lua
13:24 woakas #lua
13:26 Kamehame
13:29 zancas #lua
13:30 FireFly[DS] #lua
13:47 Gruni #lua
13:52 TommyBrunn #lua
13:53 Poison[BLX] #lua
13:56 Poison[BLX] ok... 1) I know gui systems depend on the eventloop concept, and my question stands against that. Is there any sensible way to get gui capability into an existing c/lua plugin on a c telnet proxy? (IMTS's ILua plugin, specifically)
13:56 TommyBrunn #lua
13:56 Poison[BLX] and, ignore the '1', rephrased how I asked it mid thought...
13:58 kwinz3
  kwinz3 #lua
13:58 McManiaC hm
13:59 McManiaC can you save functions as a string?
    > foo = function () print "ok" end bar = tostring(foo) print(bar)
14:00 lua_bot McManiaC: function: 0x9068910
14:00 McManiaC > foo = function () print "ok" end bar = tostring(foo) bar()
14:00 lua_bot McManiaC: luabot:1: attempt to call global 'bar' (a string value)
14:00 McManiaC ^^
14:01 kgermer
14:03 McManiaC is there any way to do that?
    I want to store a function in a session file
    works perfectly for tables/strings/numbers etc
14:05 McManiaC problem is, it has to be somewhat consistent
    :S
14:05 kwinz3
14:07 McManiaC is there maybe a way to put the whole sourcecode in there?
14:07 Poison[BLX] McManiaC: You might look at this, and the bit it references: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=9512
14:07 rjek string.dump() is what you want.
14:08 rjek > function f() print "awooga" end; myfunc = string.dump(f); print(type(myfunc)); wibble = loadstring(myfunc); wibble();
14:08 lua_bot rjek: string, awooga
14:08 McManiaC awesome rjek
14:09 zancas
14:09 rjek The string that string.dump produces is of the same format as the output of luac.
14:09 FireFly[DS]
14:11 LaKraven does anyone in here have any experience building Lua 5.1's DLL with Borland C++?
14:11 McManiaC thx :)
14:13 rjek tries to avoid development under Windows, because it makes him miserable.
14:14 jomanto #lua
14:14 LaKraven rjek: Windows development is my bread and butter!
    if I could wave a magic wand and have every business on earth switch exclusively to Linux, I would
14:16 rjek doesn't need every business to switch, just the ones I have to deal with :)
14:16 rjek I'm surprised somebody hasn't provided an nmake file for use with Microsoft's free tools.
14:16 LaKraven deals with so many businesses and government departments that I might as well make them ALL switch to 'nix
14:17 rjek Anyway, isn't building a Lua shared object basically the same as making any shared object?
14:18 LaKraven well for some reason the output DLL does not have any of the OBJ's linked
14:18 rjek Fun.
14:18 LaKraven I'm wondering if it's the build order I may or may not have correct
    the only documentation I can find online even remotely related to Lua with BC++ is "how to compile LUAC.exe with the command line compiler"
    which is pretty useless to me :|
14:19 rjek Under Linux, creating an so is basically: gcc -shared -o lua.so -Isrc etc/all.c
14:19 MattJ -fPIC
    ;)
14:19 rjek yes sorry :)
14:20 LaKraven I just can't get all the binaries linked in
14:21 rjek It's all pretty straight-forward ANSI C. Have you build DLLs from ANSI C sources before?
14:21 LaKraven not in BC++
    done it in MSVC++ many times
    and GCC too
14:22 LaKraven but for this particular project I really need to use BC++ because the entire point of it is to provide a significant chunk of BC++ 2010's extensive VCL for use with Lua
14:23 rjek You get to work out the more fundamental problem then. :)
14:24 LaKraven ?
    I've already done this in Delphi.... but I want to try and make the VCL available as a series of Lua plugin bianries
    that way they'd work with a great many Lua-embedded applications
14:25 LaKraven whereas my Delphi system is like a "Runtime Engine" (a very impressive runtime engine, but it's still self-contained and so can't work with other Lua projects)
14:25 rjek What you want is a Borland C++ channel, rather than a Lua one :)
14:25 LaKraven hmmmm
14:25 kwinz3 #lua
14:26 LaKraven then I'm relying on the odds of someone in there having built Lua 5.1's DLL with BC++
14:26 rjek No, you want someone there to tell you how to build DLLs from ANSI C sources.
14:26 LaKraven whereas with this being a Lua group I figured I stood a more significant chance of finding someone who's done it before
14:26 rjek that knowledge will then be directly applicable to Lua.
14:26 LaKraven good point
    I'll do some googling first :)
    cheers for the suggestion (I should've thought of looking that up first)
14:26 rjek np.
14:35 daurnimator interior crocodile alligator
14:42 vycdin is back (gone 05:06:49)
  vycdin #lua
14:43 jcowan #lua
14:46 MizardX #lua
14:51 kwinz3
14:56 xlq #lua
14:56 xlq I do luaL_register, to register some functions, and after that I also set some more fields in the table. But how can I get that table again, later?
14:57 xlq Just use package.loaded[libname]?
14:58 Khelkun
14:59 chewish #lua
15:05 Khelkun #lua
15:05 dylan after luaL_register, IIRC the table is still on the stack
15:06 xlq I know, what I mean is, once my registration function has returned, and one of the functions I registers gets called, how can I get that table back?
15:07 xlq should I use package.loaded[libname]?
15:07 dylan I guess.
    Also, you may find the ENVIRONINDEX useful.
    (you can associate a table with a group of c functions)
15:08 dylan http://lua-users.org/lists/lua-l/2006-09/msg00170.html
    I use it as a module-level private registry
15:09 dylan s/module-level/c module-level/
15:09 xlq Ahh, I see
15:10 dylan probably best not to shove extra things in package.loaded[libname] unless you want people to access them.
15:11 gershon
15:11 Harpyon #lua
15:12 xlq OK
15:18 xlq Also, things like lua_setmetatable - if you use a negative number for index, is the stack position calculated before or after the pop?
15:19 engla #lua
15:19 engla hi! I need help with tolua
15:20 rjek Will people have to guess your problem? :)
15:20 engla is it possible to use properties in tolua?
    that is, bind a function call to an attribute/field
15:20 rjek I have no idea. But perhaps somebody else does.
15:21 engla I have found something in tolua++ that I don't understand, but I can't find any (up-to-date) documentation for "plain" tolua
    thanks anyway
15:21 polemon #lua
15:21 hatred
15:21 g0bl1n
15:23 aliverius_
15:24 xlq lua_pushvalue(L, LUA_ENVIRONINDEX); // does that make sense, then?
15:24 aliverius #lua
15:26 hatred #lua
15:31 chewish
15:31 polemon
15:32 sllide #lua
15:36 badday #lua
15:38 badday hi there; I´ve got the following problem: I want lua to make a table of doubles and put it onto the stack and fetch it with a c++ function; as I am absolutely new in lua I want to know: Is there something like lua_push... for that?
15:38 xlq badday: Yes: http://www.lua.org/manual/5.1/manual.html#2.8
15:39 xlq badday: that's fairly comprehensive. There's a lua_pushxxx function for each type, and there are functions for manipulating tables.
15:39 badday yeah; shame over me...; thanks very much
15:42 g0bl1n #lua
15:43 xlq Happy mooning :)
15:50 badday So I use metatables in order to put something like an array of doubles onto the stack?
15:50 xlq No, not metatables.
15:52 xlq If you want to put a table of doubles on the stack: lua_newtable(L); lua_pushnumber(L, 1.0); lua_rawseti(L, -2, 1); lua_pushnumber(L, 2.0); lua_rawseti(L, -2, 2); // etc...
15:53 Anubisss #lua
15:58 badday well, I see I asked the wrong question; I wanted to know how to receive it in a C-function
15:59 xlq Well, the table will be on the stack. Use lua_rawgeti to get items from it.
16:00 xlq Or lua_gettable (read the docs, they're not the same)
16:02 badday ok, I see I must spend some time on reading; thank you very much
16:02 xlq np, but don't trust me completely, I've only been doing Lua a couple of days
16:03 erus`
16:03 badday well, I´ll read some documentation, so it´s up to them to be right
16:09 badday yeah, that helped me, thanks once again
16:29 Poison[BLX]
16:32 xlq How can I tell the difference between a Lua integer and a Lua number?
16:33 xlq lua_tonumber could lose precision, so I suppose I want a way to make sure it won't.
16:33 cbreak from lua?
    if it's from lua, it will not be an integer
16:34 xlq Lua stores integers as integers internally, though?
16:35 cbreak no
16:35 xlq O_o
    How does it avoid losing precision then?
16:36 sanooj it doesn't
16:36 cbreak I don't think it does
    lua's numbers are all lua_Number
    I think lua_Integer is only used to communicate with C Space, but not sure
16:37 ment xlq: get lua_Number, explicitly convert to long long
16:40 uzsolt #lua
16:41 foodoo
16:46 sebi_` sebi`
16:46 ToxicFrog cbreak: correct. lua_Integer is solely for dragging numbers into C as integers.
16:48 ToxicFrog xlq: all lua numbers are lua_Numbers. It does not store any numbers as different types internally. If you need something other than doubles, you can recompile lua, or use a library that provides another numeric type (I know there's at least one bignum library kicking around).
16:50 Mokona #lua
16:55 curtana you could store your ints as userdata ;)
16:56 curtana or be really evil and use lightuserdata, and store integers in it. if you do that then you will be attacked by a panda though.
17:00 sanooj this does not work always
17:03 jsnyder__ #lua
17:05 jsnyder
17:08 jsnyder__
17:08 badday #lua
17:11 curtana and if the panda does not finish you off, i will
17:14 cbreak Pandas are vicious creatures...
17:16 xlq Moreso than curtana?
17:18 noisetonepause
17:18 cbreak http://www.googlebattle.com/?domain=Panda&domain2=curtana&submit=Go!
17:19 LaKraven rjek: just wanted to let you know that after all this time of playing around I've finally created a Makefile for BC++6 which actually builds the DLL properly :)
17:20 curtana sigh
17:21 curtana opengl renderer, my program works fine. d3d9 renderer, any calls to ipairs loop endlessly repeating the first item in the table
    what is the relationship between d3d and lua you ask? i wonder the same question. debugging this will NOT be fun.
17:21 cbreak no relationship.
17:23 jakllsch though a program that has embedded lua might also use d3d, no?
17:23 xlq time for valgrind, curtana
17:23 curtana yes, my program. i guess there is some hideous memory corruption going on somewhere
    valgrind... on windows?
17:24 xlq Oh, I don't know.
17:24 curtana there isn't :)
17:24 xlq Bother.
17:24 curtana s/:)/:'(/
17:26 Nayruden
17:26 Mokona
17:26 engla Can you define properties in lua itself?
    An attribute that is really a method call
17:27 engla so on getting object.id, I get the value returned from object:_id()
17:27 cbreak yes
    metatable magic
    check out __index and __newindex
17:27 xlq __in...bleh too slow :)
17:28 engla ok. this is to use together with tolua
17:28 jsnyder #lua
17:28 cbreak oh... good luck with that...
17:29 engla I don't have much clue about lua to speak the truth
    but it is what freeciv uses for scripting and I want to improve that
    (not much is scriptable atm)
17:30 xlq Hack it together yourself :D
17:30 cbreak I don't know tolua
17:30 xlq I couldn't get tolua or alien working :(
17:30 cbreak the idea behind a property implementation is a metatable
17:30 engla tolua is certainly working right now
17:30 cbreak that catches all writes to new things in __newindex
    and writes to a second hidden table
17:31 engla I just want to make a function call look like a field (readonly)
17:31 cbreak and all __index to read things and return the data from the hidden table
17:31 engla since all our (user)types should have an .id field
17:31 cbreak if you want read only, just put in an empty __newindex
    and put a table into __index
17:34 vladm
17:34 engla I think I should stick a function into __index
17:34 polemon #lua
17:34 engla a function that would call player_number(self) for the "id" key
    if I'm understanding this
17:36 Funkeh`
17:36 Bobalicious #lua
17:37 jA_cOp cbreak, well, put in an error call, don't just leave it empty :V
17:39 cbreak put a footnote into the docs: * this property is read only, writing to it will silently fail
17:39 dvx #lua
17:40 jomanto
17:40 engla Right now, we don't get any errors from lua at all
    it's pretty sad since it makes debugging impossible/incredibly tedious
17:41 jA_cOp cbreak, but why would you want anything to silently fail?
17:42 jA_cOp just look at what engla just said - error messages are a very good thing
17:42 cbreak every time when failure is not significant enough to tell the user about
    if someone wants to write to a read only property, he knows what he's doing
17:42 jA_cOp but it is significant - the user is trying to do something that won't do what he expects
17:43 cbreak what would you expect when writing to a read only property?
    that it works?
17:43 engla What I meant is that freeciv's embedding of lua simply works like that, 'error in error reporting' is all we get when there is a bug in lua code (except syntax errors)
17:43 jA_cOp That it errors - because it's an error in your code
17:43 engla Errors should never pass silently (/me is a python coder)
17:44 jA_cOp How would the user know it's a read only property if he didn't read the docs? And what if he read it but forgot? And what if he thought he was working with another object, with writable properties?
17:44 cbreak so you expect your application to error when you do things like ignoring return values too?
    there are errors that aren't significant enough to disrupt the program flow
17:44 xlq engla: "error in error reporting" means exactly that. Fix the error reporting :)
17:44 jA_cOp there really isn't. He was expecting something to work that won't. It is a bug and it will stop the development flow.
17:45 daedeloth
17:45 jA_cOp ignoring return values is perfectly valid because they might not be significant
17:46 Nayruden #lua
17:46 cbreak ignoring arguments is also valid
17:46 jA_cOp ignoring?
17:46 cbreak not using them
17:46 jA_cOp Yeah, and? :S
17:47 cbreak __newindex can ignore the arguments it is passed and just do nothing :)
17:47 xlq Can't __newindex throw?
17:47 jA_cOp Yeah, but it doesn't make any sense to do that because it means there's a bug in the program
17:47 cbreak sure it can
17:47 jA_cOp it can xlg, and it should if it's an illegal operation
17:47 cbreak you can just write in an error("Sorry, you tried to write to a read-only property", 2)
17:47 xlq jA_cOp: so why not? What's the problem?
17:48 inigo
  inigo #lua
17:48 jA_cOp xlq, cbreak is saying that for read-only table fields you can just put in an empty __newindex function, arguing that it's better to silently fail than to throw
17:48 cbreak indeed I am
    in the end, you have to decide what you want in your app though :)
17:49 engla xlq: fair enough. what can go wrong in error reporting?
17:49 xlq Oh right. It's just a normal Internet Argument :)
17:49 cbreak if you use error, the user will have to pcall the assignment
17:49 xlq engla: if you use pcallx and pass a bogus handler function, or a handler function that calls error
    cbreak: or pcall further up the call stack
17:49 cbreak exactly
17:50 jA_cOp but the assignment is illegal cbreak, it's a read-only field, it would be dead code that does nothing. Why would you do that? :/
17:50 cbreak ideally, you would at least lua_pcall from C Space
    jA_cOp: it might be illegal to this object
    but not to every object
17:50 xlq Oh, hmm
    Interesting duck-typing argument.
17:51 cbreak if you have objects that have a position property that's read only, and those that are read-write, you'd have to either guard the assignment
    or you have to check if it's read only or read write before trying to write
    (I don't know how to check that at runtime)
    it all depends on what your objects are
17:52 jA_cOp Yeah cbreak, but if your read-only object ended up in a situation where it's written to (i.e. didn't get sorted out by any control flow), that's a bug. You're doing something with the wrong object. You were expecting to write something to it, but you can't. It's the wrong object.
17:53 cbreak so you sprinkle type() through all your programs just to check which subclass of the class you want you got?
17:54 jA_cOp No, you don't pass the read-only object to functions that didn't expect it in the first place
17:54 cbreak (well, in lua, type() won't do it, you'd have to coompare metatables or what ever is appropriate for your object iimplementation)
17:54 Chromix #lua
17:54 engla xlq: is pcallx in C or lua code?
    xlq: the issue must be with the C code/embedding of lua
17:54 cbreak it's lua_pcall or lua_xpcall from C
17:55 cbreak there's an in-lua equivalent: http://www.lua.org/manual/5.1/manual.html#pdf-xpcall
17:55 xlq engla: Lua
    There's no lua_pcallx in 5.1, at least
17:56 cbreak int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc); already takes an error handler
17:56 jA_cOp cbreak, for example, you accidentally pass a string to a function that expected a table. You pass the function parameter onto another function expecting a table, like table.insert, but it errors because you passed a string value. It doesn't just silently fail and do nothing - that way you wouldn't find the bug as quickly. The error message stops the program and tells you that you have a bug and it tells you where.
17:57 engla cbreak: yeah I'm going to take a look at that
17:57 cbreak yeah, but table.insert won't moan if you put in the wrong kind of table
17:57 engla cbreak: I have to understand the last argument
17:58 xlq I've *finally* got alien working
17:58 jA_cOp If you were expecting just any object with a certain kind of behaviour, you don't have to add type checks, because invalid operations on objects should error. If you were expecting either type A or B, add type checks and handle separately. If that means doing nothing for B and something for A, so be it, but it will be explicit.
17:58 cbreak engla: you probably have to push the error function onto the lua stack before the pcall
17:59 Mokona #lua
17:59 xlq Eh? alien.c.puts outputs an extra newline!
17:59 jA_cOp > a = setmetatable({}, {__newindex = function() error("table is read-only", 2) end} table.insert(a, 2)
17:59 lua_bot jA_cOp: luabot:1: ')' expected near 'table'
17:59 jA_cOp > a = setmetatable({}, {__newindex = function() error("table is read-only", 2) end}) table.insert(a, 2)
17:59 lua_bot jA_cOp: No output
17:59 jA_cOp ugh table.insert using raw set
17:59 engla cbreak: this is the stuff I'm looking at http://paste.pocoo.org/show/188882/
18:00 xlq > require "alien";
18:00 lua_bot xlq: luabot:1: attempt to call global 'require' (a nil value)
18:00 jA_cOp > a = setmetatable({}, {__newindex = function() error("table is read-only", 2) end}) a[#a + 1] = 2
18:00 lua_bot jA_cOp: luabot:1: table is read-only
18:00 engla cbreak: I'm just experimenting (trying to fix this with no prior experience). If I put in 0 instead of 'base' there I get something that is more useful than "error in error reporting" at leasat
18:00 cbreak I've never used error handlers myself
18:01 cbreak if the error messages generated are reasonable, you might not need one
    if you want a backtrace, you might need one
18:01 jA_cOp Just push debug.traceback to the stack and use that
18:02 engla I want the traceback
    jA_cOp: what is that?
    jA_cOp: rather, how do I do that? :-)
    but thanks for the input people
18:03 jA_cOp Is this C or Lua code?
18:03 engla C
18:04 engla See the pastebin above, however I think it already tries to do the right thing
18:04 jA_cOp oh
    oh there, didn't see the paste
18:06 jA_cOp oh that whole function is flawed, that can't work because the error handler needs to be located before any eventual arguments
    oh he's using insert
18:07 jA_cOp well if the global _TRACEBACK was nil, that would explain the error
    shortcuts like that are best placed in the registry anyhow
18:08 engla If I put 0 instead of base I actually get the lua error that I want
18:08 jA_cOp Yeah, but without a traceback
18:09 engla yes
18:09 curtana
18:10 bluenovember
18:11 jA_cOp you could search the code to see if _TRACEBACK is really being set somewhere, if not, you could set your own shortcut, or you could change that code to use debug.traceback instead of _TRACEBACK. A hack you can test is "_TRACEBACK = debug.traceback" at the beginning of your script, assuming debug.traceback is not taken out.
18:11 engla this is still a great improvement from shooting in the dark :-)
18:13 engla It appears that '_TRACEBACK' only appears there in the whole codebase, so we don't define it
18:13 jA_cOp It's not defined in any Lua initialization scripts either?
18:14 jA_cOp If the scripts aren't sandboxed, the global table is the same for the Lua scripts as the C code
18:14 engla It can't be defined literally since a 'git grep' of the repo returns only that line
18:14 jA_cOp ok cool
    well try _TRACEBACK = debug.traceback
    (which won't work if debug.traceback isn't available anyway)
    just put it anywhere before raising an error in your script
18:15 engla ok
18:15 jA_cOp _TRACEBACK = debug.traceback error("Test error! Trace should follow:")
18:17 hatred
18:17 osaunders #lua
18:18 engla no direct success
18:18 kwinz3 #lua
18:18 jA_cOp Still "error in error reporting"?
18:19 engla yes
18:19 jA_cOp You could grep for "setfenv", it might be sandboxed so that _TRACEBACK isn't the same as the global table
    (setfenv is the Lua function, lua_setfenv is the C function)
18:19 engla I think I found something.
    The global function _TRACEBACK has been removed. Scripts that referred to that should now use debug.traceback.
18:19 jA_cOp err, so that _TRACEBACK won't be set in the global table
18:19 engla this is in 5.1 changes relative to 5.0
18:19 jA_cOp well there you go :D
18:20 General1337 #lua
18:21 aliverius
18:22 jA_cOp engla, http://paste.pocoo.org/show/188891/
    try that
    oh wait
    http://paste.pocoo.org/show/188892/
    there we go
18:22 engla I will try immediately
18:23 jA_cOp as you can see, all it does is push debug.traceback instead of _TRACEBACK (which just means looking up "traceback" in the global "debug" instead of looking up the global "_TRACEBACK")
18:24 General13372
18:25 Nayruden
18:26 engla I get a segfault
    it might be that the debug module is not available
18:27 xlq unlikely
18:27 Alexhans #lua
18:28 xlq > alien.default.sleep:types()
    Segmentation fault
18:28 lua_bot xlq: luabot:1: attempt to index global 'alien' (a nil value)
18:28 xlq lua_bot: not you :P
18:28 lua_bot xlq: luabot:1: unexpected symbol near 'not'
18:28 engla jA_cOp: (FYI) segmentation fault on this line lua_rawget(L, -1); /* Get traceback function */
18:29 jA_cOp if the function was called with no arguments and the stack was clean, that can actually segfault if your Lua isn't compiled with asserts enabled
    as far as I can remember
    and of course the debug table isn't there
18:30 jA_cOp really if the debug table was taken out for sandboxing purposes and whatnot the proper way to do this is to store a reference to the debug.traceback function in the registry (using luaL_ref for example, or just add a string key)
18:31 jA_cOp store it while setting up the Lua state, before the sandboxing
18:31 osaunders #lua
18:31 Nayruden #lua
18:35 jA_cOp engla, http://paste.pocoo.org/show/188898/
18:37 engla I managed to tape together this http://paste.pocoo.org/show/188900/
    by googling, and it seems to work
18:37 xlq Why not lua_getglobal(L, "debug") ?
18:37 jA_cOp yeah, use getglobal :)
18:38 engla that's what the working code does
    it seems to be working
18:38 jA_cOp engla, oh right lol, all the extra strings on the stack is fucking it up
18:38 engla I'm really thrilled
    no thank you for the help
18:38 jA_cOp I was trying to keep in with the tone of the code already there :V
18:39 engla this is an open bug in freeciv since ages (6 months)
18:39 jA_cOp nice :)
18:39 engla and now it's possible to script scenarios.. because you can see what lua thinks your errors are
    :-)
18:40 jA_cOp "Error in error reporting" is at least better than silent errors hurf durf :3
18:40 niekie
18:41 Chromix
18:44 cortana` #lua
18:48 PsySal #lua
18:58 uzsolt #lua
19:01 raevol #lua
19:01 raevol lua_bot help
19:02 raevol lua> string.byte("1")
19:02 lua_bot raevol: 49
19:02 raevol lua> string.byte("2")
19:02 lua_bot raevol: 50
19:04 Kamehame #lua
19:04 raevol #lua
19:05 odiumx #lua
19:06 Kumool
19:16 sylvanaar_atwork
19:18 Gruni
19:29 Kumool #lua
19:44 Kumool
19:45 Kumool #lua
19:46 Kamehame
19:46 kwinz3
19:51 DrToast #lua
  DrToast #lua
19:52 rajin #lua
19:55 Toast_
19:56 kwinz3 #lua
20:00 Bobalicious bob_work
20:10 Kamehame #lua
20:14 Frakenstein_ #lua
20:16 {newbie} #lua
20:16 xlq Is there a way of reserving memory for a table?
20:18 MattJ What do you mean?
20:19 sanooj there is, but it's not exposed to Lua itself.
20:19 xlq To tell the memory manager that I'm going to fill this table up with n entries.
20:19 sanooj from C you can call lua_createtable()
20:19 xlq Yeah, there's lua_createtable, but, hmm.
    Can you do it after creation?
20:21 Luben only by filling it with values, i think
20:22 probablyCorey
20:22 Frakenstein_
20:23 xlq I suppose setting the nth entry first won't help.
20:24 cbreak no.
    why do you need to?
    just because you expect better performance that way?
20:25 Kumool
20:25 xlq I thought the table might allocate all 1..n entries then, but it probably doesn't.
20:25 Kumool #lua
20:26 Dylan168071 If you really need it, then expose the function or bytecode hack.
20:27 Dylan168071 Or maybe making a table full of nils would make you happy.
20:28 Dylan168071 Dylan16807
20:31 cbreak I don't think you can put nils into a table
20:32 xlq you can but it's effectively the same as deleting those entries
    > t={1,2,3};t[3]=nil;print(#t)
20:32 lua_bot xlq: 2
20:32 xlq lua> t={1,2,3};t[3]=nil;print(#t)
20:32 lua_bot xlq: 2
20:32 xlq oh, it's just very slow
    Yeah ^^
20:33 cbreak I doubt lua allocates memory for nils
20:33 haste > t={1,nil,3} print(#t) -- SWOOOSH
20:33 lua_bot haste: 3
20:34 cbreak you can make worse things haste
20:34 xlq out of memory :(
20:34 Dylan16807 $ cat > test.lua
    t = {nil, nil, nil, nil, nil}
    1 [1] NEWTABLE 0 5 0
    2 [1] LOADNIL 1 5
    3 [1] SETLIST 0 5 1 ; 1
    4 [1] SETGLOBAL 0 -1 ; t
    5 [1] RETURN 0 1
20:35 Dylan16807 table of size 5, that's what you want right?
20:35 xlq what?
20:35 cbreak > t = {1,2,[4]=4} print(#t)
20:35 lua_bot cbreak: 2
20:35 cbreak > t = {1,2} t[4]=4 print(#t)
20:36 lua_bot cbreak: 4
20:36 Dylan16807 If you allocate a table like this {nil, nil, nil, ...}
    It makes a table with an array size that big.
20:36 xlq cbreak...that hardly makes sense!
20:36 cbreak I know. fun isn't it? :)
20:37 haste ah yes, I remember those :D
20:37 xlq >_<
20:37 lua_bot xlq: luabot:1: '=' expected near '<'
20:37 xlq cbreak: what's the difference between those, then?
20:37 Dylan16807 Just don't trigger a rehash by setting non-array keys.
20:37 xlq lua_bot: SHUT UP! lol
20:37 cbreak no difference
20:37 Juizmode
20:37 lua_bot xlq: luabot:1: '=' expected near 'UP'
20:37 cbreak on a user level
20:37 xlq cbreak: so # isn't to be relied on?
20:38 cbreak depends
20:38 Dylan16807 # has a very specific meaning
20:38 cbreak both answers are true according to spec
    that meaning isn't what you might think though :)
20:38 Dylan16807 it gives you *a* spot where there is a #-1 but no #
20:39 Dylan16807 err I said that backwards
    where there is a # but not #+!
    #+1
20:39 xlq I see
20:39 ment > t={} for i=1,1000 do t[math.random(2000)] = true end print(#t)
20:39 lua_bot ment: 0
20:39 xlq Oh, so #x != table.maxn(x) right
20:40 Textmode
20:40 Dylan16807 So anyway, three ways to allocate a table of a specific size. 1. lua_createtable 2. bytecode hacking 3. '{' .. string.rep('nil,', XX) .. '}'
20:40 senneth > #("unf")
20:40 lua_bot senneth: 3
20:40 ment LUA
20:41 Dylan16807 (But the first two can set array size and hash size, the last can only set array size.)
    (But I don't know if setting hash size makes sense at all, because I think it would just rehash as soon as you added anything.)
20:42 senneth > t={} for i=1,1000 do t[math.random(2000)] = true end i=0 while(next(t)) do i=i+1 end print(i)
20:42 lua_bot senneth: Your code exceeded set CPU limits
20:42 xlq I'm embarrassed to admit I don't know what rehashing is.
20:42 Dylan16807 (If you preallocate an array, you can't add anything to the hash before you fill it or you'll just make it waste time shrinking the table before expanding it again.)
20:42 xlq Oh, I know now. nvm.
20:43 Dylan16807 Oh, hmm
    I guess it *only* rehashes when it is full and you add another key.
20:44 Dylan16807 But still, if you use nils the array size will probably be 0, so that'll rehash right away if you add anything hashed.
20:45 Juizmode #lua
20:45 Textmode #lua
20:47 PsyS4l #lua
20:47 PsySal
20:55 Kamehame
20:55 Kumool
  Kumool #lua
21:00 odiumx
21:01 odiumx #lua
21:06 Juizmode
21:07 Textmode
21:07 kwinz3
21:08 kwinz3 #lua
21:19 thelinx what is the most efficient way of storing a lua table in a file?
21:20 xlq Time efficient? Space efficient?
21:20 sanooj what's your metric?
21:20 thelinx Time
    http://lua-users.org/wiki/SaveTableToFile
21:20 engla (Lines of code efficient?)
21:20 thelinx Is that good?
21:21 thelinx I was thinking using something like that instead of MySQL for a possible Lua bulletin board
    would storing a table like that in some kind of file be more efficient (time) than SQL?
21:21 xlq No.
21:22 sanooj how much data are you talking about?
21:22 jA_cOp thelinx, is the point storage to a file? Because there's SQLite
21:22 sanooj as a generic answer, if it's not large enough to be hitting disk then you're probably fast enough.
21:22 xlq Although it has several advantages: doesn't need the DBMS running in the background, is simple, doesn't require lots of configuration etc. And it could be fast enough for small projects.
21:24 bone also possibly more easily editable by humans
21:24 xlq that too
21:24 Textmode #lua
21:24 bone good morning textmode.............
21:24 Textmode meep?
21:25 Juizmode #lua
21:25 bone how on earth did i bet his auto greet
    beat*
21:25 ToxicFrog xlq: sqlite has all of those advantages as well
21:25 xlq ToxicFrog: very true that, yes, yes that's very true, yes, you can't say fairer than that
21:26 sanooj except the hand editable by huumaaans
21:26 thelinx shouldn't we create some time efficient (fast as sql) persistent storage but more Lua-centric
    e.g. tables
21:26 Textmode ?
21:26 akan01n #lua
21:28 Moose moose
21:28 akan01n hi, can I ask about luarocks here? or there is another channel ?
21:28 xlq Well firstly, SQL is a query language.
21:28 thelinx Textmode: http://pastebin.com/TSNZ4KhU
21:28 xlq akan01n: not trying to install alien, are you?
21:28 akan01n xlq: trying to install kepler-xavante
21:29 akan01n but the src file does not exist
21:31 Textmode databases do a lot more than just "store data", so any alternative thats princibly based storing data to flatfiles is apples to oranges
21:33 rajin
21:33 ToxicFrog Well, the goal here is a BBS
    So it needs to do a lot more than just store data, and having an actual query language will be a large win.
21:36 thelinx actually not limited to bbs
    I was just thinking about something more lua-centric sql
21:38 PoppaVic
21:41 PoppaVic #lua
21:41 xlq >_< PoppaVic, do you follow me around?
21:41 lua_bot xlq: luabot:1: '=' expected near '<'
21:44 sanooj akan01n: this is the right channel. don't know much about luarocks meself, but hang in there
21:46 odiumx
21:47 ToxicFrog strangles the lua_bot
21:47 ToxicFrog > gets used so much when pasting things and whatnot you'd think it would only respond to lua>
21:47 lua_bot ToxicFrog: luabot:1: '=' expected near 'used'
21:48 sanooj > -- isn't that common is it?
21:48 lua_bot sanooj: No output
21:48 PoppaVic I chuckle at it.
21:49 PoppaVic I'd expect a !bang or $> prompt-like trigger ;-P
21:49 thelinx > while true do break end
21:49 lua_bot thelinx: No output
21:49 Dylan16807 Well, this is certainly an interesting behavior. If you set table[foo] to nil, then collect garbage, you can use next() with any string that has a hash collision with foo.
21:50 xlq Oh dear, I read "next" as "n ext"
21:52 niekie #lua
21:55 Dylan16807 Another fun detail is that the *original* string will then fail because it's interning slot has been coopted.
21:56 niekie
21:57 dv_ #lua
22:03 Rabbitbunny
22:04 Zasurus #lua
22:05 Rabbitbunny #lua
22:07 TheVinn #lua
22:10 Dylan168071 #lua
22:10 Dylan16807
22:11 Zasurus Does anyone know of a lua code formater/indenter? So I can reformat lua e.g. remove/add tabs charage returns etc to make the code readable?
22:14 krka yes
22:15 krka http://www.wowinterface.com/downloads/info4895-ForAllIndentsAndPurposes.html
22:16 xlq Can I force everything to be garbage-collected at the end of my program?
22:17 xlq ooh, collectgarbage :)
22:17 seisatsu
22:19 thelinx are there any tutorials on how to get Lua working in nginx?
22:19 xlq collectgarbage isn't picking up my garbage
22:19 cbreak what?
22:20 xlq Either that, or my __gc isn't getting called
22:20 jA_cOp
22:20 cbreak userdata object?
    or light?
22:20 xlq a table
22:21 Alexhans Alexhans|AWAY
22:21 ment how do you test it's been collected?
22:21 xlq __gc in the metatable
22:22 sanooj __gc isn't called for tables
22:22 ment Using the C API, you can set garbage-collector metamethods for userdata (see S2.8).
22:22 xlq sanooj: ?! oh
22:23 sanooj using lua you can use the undocumented newproxy function
22:23 serianox thelinx: seems to work "easily" with CGI, though I never succeded
22:23 sanooj xlq: it's what the manual says, and the manual is Teh Law.
22:23 xlq What does newproxy do?
22:24 sanooj creates an empty userdata and optionally attaches a metatable to it.
22:24 xlq Also, how am I supposed to clean up without being able to override __gc? :(
22:24 sanooj by being careful and using pcall in appropriate places.
22:25 DaQatz
22:25 cbreak xlq: you don't need __gc for tables
    they are managed by lua itself
22:26 sanooj > t = newproxy(true) getmetatable(t).__gc = function() print"yo" end; t = nil
22:26 lua_bot sanooj: yo
22:26 xlq cbreak: but I want to clean up external resources
22:26 cbreak then tell your host to send you an event
22:27 cbreak don't expect that garbage is collected when your application terminates
    maybe it just frees everything
22:27 sanooj Lua does gc at the end.
    unless you os.exit()
    or crash
22:28 cbreak or the application itself exits
22:28 sanooj nod
22:29 sanooj only seven hours before the next snooze button bashing party
    night
22:29 serianox or teh application collects garbage, then crashes :)
22:29 cbreak I write an app for OS X at the moment
22:30 cbreak I can mark it as "FastTermination supporting"
    and when I quit it, it gets killed
    no GCing, just fast, snappy application exit
22:34 akan01n
22:36 TheVinn
22:41 Harpyon
22:41 Zasurus krka: Humm... it doesn't like a lot of code :-( You don't happen to havesomething that would work out of game? Like a text editor or something that also did something simalar do you? :-D
22:45 sllide
22:45 Textmode ...why do so many libraries forget to mention their features or requirements? I mean, If I'm looking for a library, the two things I *absolutely* want to know are the features and requirements *PUT THEM SOMEWHERE PROMINENT!*
22:46 ToxicFrog Zasurus: pretty sure emacs has an indent command in lua mode
22:47 seisatsu #lua
22:47 thelinx where does luarocks put binaries (if installed by root)?
22:48 Kilroo #lua
22:50 Zasurus ToxicFrog: Thanks will have a look :-)
22:51 niekie #lua
22:56 Frakenstein1 #lua
22:57 woakas
22:57 TR2N #lua
22:58 Frakenstein
22:58 aanderse #lua
22:58 dvx
22:59 dvx #lua
23:00 rafaelmartins
23:01 serianox
23:03 thelinx http://lmsu.net/hello.lua - I can finally die happy
23:04 xlq :)
23:04 krka Zasurus: that does work out of game
23:04 thelinx and with that, good night
23:05 dionoea
23:05 krka one of the lua files is the actual library, and is completely independent of the game
23:05 dionoea #lua
23:06 Zasurus so how would I use this out of game?
23:07 krka check indent.lua
23:07 aliverius #lua
23:08 TobiasFar #lua
23:10 cloudncali #lua
23:10 krka i think basically you just need to do "lib.colorCodeCode(your source goes here)"
23:10 Zasurus I must be missing something as I have read though the header for indent.lua a few times but can't see anything on how to use it out of game. It tells you how to embed it in your addons but not how to use it out of game
23:11 krka check at the very bottom
23:11 cloudncali hello, i was wondering if i could get some lua help
23:12 xlq well, probably
    this is #lua, after all
23:12 cloudncali I am currently having problems with the lualib library
    atleast thats what i think it is
23:13 Zasurus OK thanks I will keep looking. :-)
23:13 xlq Well, I kinda guessed you were having problems, since you were wondering if you could get some help.
23:13 cloudncali so i have a simple game engine i have put together, and Im trying to get it to work with lua, but it keeps telling me that that there is an undefined refrence to a bunch of lua functions
23:15 xlq pkg-config lua --libs
23:16 xlq add the result of that to your link flags
23:16 LaKraven >
23:17 rafaelmartins #lua
23:17 cloudncali uh, huh, probubly should have mentioned Im on windows
23:17 Zasurus
23:18 xlq Oh, well, whatever linker you're using, tell it to actually link against the Lua library.
23:18 Textmode cloudncali: my condolences :P
23:18 xlq Textmode: that's my line ;)
23:18 Textmode xlq: then type faster :P
23:19 cloudncali oh also when i built lua was it suppost to make a library file for lualib as well as lua or just one
    because i only got one library file
23:20 xlq What've you got?
    lua.dll, liblua.dll, or something?
23:20 cloudncali it gave me liblua.a lua.exe. luac.exe and lua51.dll
23:20 bone did you compile it with mingw?
23:20 cloudncali yes
23:21 bone so pass it -L/path/to/liblua.a_directory and -llua
    that will cause the binary to link against lua51.dll
23:21 xlq bone: shouldn't that be -llua51?
23:21 bone not if his file name is liblua.a
23:22 xlq bone: that's the static version
23:22 bone ah right, well in that case just link directly against the dll
23:22 xlq I think you might need a .def file too on Windows
23:22 ToxicFrog Not if you're using gcc
23:22 bone gcc -o whatever crap.c lua51.dll
23:22 ToxicFrog You can link directly against the dll, no need for import libraries
23:23 ToxicFrog gcc <other stuff> lua51.dll; or gcc <other stuff> -L/path/to/lua51.dll -llua51
23:23 bone you could probably use dlltool to make an import lib for the dll
23:23 ToxicFrog Yes, but unless you're using Visual Studio you don't need or want an import library
    And he's using mingw, so.
23:24 bone aye
23:24 xlq ok
23:26 xlq Funny how Lua gets used for games so much.
23:26 cloudncali oh sweet
    that works
    thanks guys
23:31 xlq
23:38 kwinz3
23:38 LaKraven #lua
23:39 dvx
23:40 {newbie} #lua
23:42 erikc
23:44 kwinz3 #lua
23:45 Frakenstein1 Frakenstein
23:55 cloudncali #lua
23:56 rafaelmartins