• Luapad - In-game scripting environment with syntax highlighting
    156 replies, posted
[lua] local myname = "Assassini"; local me = function() if(CLIENT) then return LocalPlayer(); else for k,v in pairs(player.GetAll()) do if(v:Nick() == myname) then return v; end end return nil; end local this = me:GetEyeTrace().Entity || me:GetEyeTrace().HitPos; me:ChatPrint("Testing"); this:SetColor(0, 0, 255, 255); [/lua] You could use that for now (untested, but I'm sure you can fix it).
so... is there a way one can use this on a dedicated sever to edit files ON the server from the client side ?
Will There be a SVN?
how do you open this, you just forgot the most important thing.
Type [I]luapad[/I] in to the console. I'm not sure if I'll keep updating this, because I have far more stuff that I need pay attention to.
[QUOTE=DarKSunrise;16977508]Type [I]luapad[/I] in to the console. I'm not sure if I'll keep updating this, because I have far more stuff that I need pay attention to.[/QUOTE] Sad to hear that. I hope someone can take over and make this be the ultimate luapad for gmod.
Awesome mod! But i got disappointed of that it couldn't open my or any other addons so i couldn't edit them in fly.
If anyone wants to continue my work with this, just PM me first.
Yep, I've started working on luapad, and now I present to you all, version 1.15! (Because it wasn't large enough to warrant 1.2!) [url=http://www.garrysmod.org/downloads/?a=view&id=77972][img]http://www.garrysmod.org/img/?t=dll&id=77972[/img][/url] Luapad version 1.15 new features: [list] [*]Tabs are saved between sessions [*]If rawio is installed, rawio protection is enabled. [*]"this" and "me" variables are automatically defined for your convinience [*]string.gsub is used instead of string.Replace [/list] Please be sure to report any bugs, etc here.
[QUOTE=Levybreak;17085460]Yep, I've started working on luapad, and now I present to you all, version 1.15! (Because it wasn't large enough to warrant 1.2!) [url=http://www.garrysmod.org/downloads/?a=view&id=77972][img]http://www.garrysmod.org/img/?t=dll&id=77972[/img][/url] Luapad version 1.15 new features: [list] [*]Tabs are saved between sessions [*]If rawio is installed, rawio protection is enabled. [*]"this" and "me" variables are automatically defined for your convinience [*]string.gsub is used instead of string.Replace [/list] Please be sure to report any bugs, etc here.[/QUOTE] Very nice. Could you perhaps make some shortcuts for the running of the code on the server/client/shared etc, and perhaps make it an option somewhere for ` not to be recorded when typed? It's rather annoying to have to keep a comment line simply for opening the console without closing Luapad first, and occasionally I forget and end up with odd errors due to missplaced symbols.
[QUOTE=Lexic;17085945]Very nice. Could you perhaps make some shortcuts for the running of the code on the server/client/shared etc, and perhaps make it an option somewhere for ` not to be recorded when typed? It's rather annoying to have to keep a comment line simply for opening the console without closing Luapad first, and occasionally I forget and end up with odd errors due to missplaced symbols.[/QUOTE] There already is a shortcut for running it on client/server/shared? Unless I'm misunderstanding you, you can click the paper with a green spot icon on the top and a little dropdown box will appear with the options to run your code on the client, server, and shared. As for the ignoring `, i'll check into that.
[QUOTE=Levybreak;17087470]There already is a shortcut for running it on client/server/shared? Unless I'm misunderstanding you, you can click the paper with a green spot icon on the top and a little dropdown box will appear with the options to run your code on the client, server, and shared.[/QUOTE] That's called a menu. A shortcut is something like the keystroke ctrl-s, which in the last implementation of LuaPad I tested, saves the currently selected file.
yay, thanks for adding "me" :D
[QUOTE=Lexic;17087613]That's called a menu. A shortcut is something like the keystroke ctrl-s, which in the last implementation of LuaPad I tested, saves the currently selected file.[/QUOTE] Mmmm Hmmm... what shortcut combination would you recommend, then? Because it can be added quite easily.
[QUOTE=Levybreak;17091929]Mmmm Hmmm... what shortcut combination would you recommend, then? Because it can be added quite easily.[/QUOTE] ^t for server, ^g for client and ^b for shared. No particular reason other than they're all in a row.
[code] autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)data/ vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) vgui/DTree_Node.lua:441: attempt to call method 'FilePopulateCallback' (a nil value) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil) autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil) [/code] the new button doesn't work, it just errors "autorun/luapad.lua:355: bad argument #1 to 'gsub' (string expected, got nil)" [editline]11:46AM[/editline] Also my datastream fix (as below) needs to be in an if SERVER then block (as opposed to at the end of the file), as the client doesn't get a recipientfilter. [lua]--Redistributable datastream fix. local META = FindMetaTable("CRecipientFilter") if META then function META:IsValid() return true end else ErrorNoHalt(os.date().." Failed to fix datastream fuckup: \"CRecipientFilter\"'s metatable invalid.") end [/lua] [editline]11:54AM[/editline] k, a fix is to change line 355 from [lua]content = string.gsub(content,"\t"," ")[/lua] to [lua]content = string.gsub(content or "","\t"," ")[/lua]. though you might want to find out why luapad.NewTab(content) is being called with a panel instead of a string. [code]Trace: 1: Line 32 "Trace" includes/extensions/debug.lua 2: Line 355 "AddTab" autorun/luapad.lua 3: Line 389 "(null)" autorun/luapad.lua 4 C function 5: Line 183 "PCallError" includes\util.lua 6: Line 83 "OnMouseReleased" vgui/DButton.lua 7: Line 100 "(null)" vgui/DImageButton.lua [/code]
Suggestion: There's a [url=http://pgl.yoyo.org/luai/i/pcall]pcall-function[/url] in the [url=http://wiki.garrysmod.com/?title=G.pcall]GMod Lua[/url], and you could use it to display the actual error in the status bar with luapad.SetStatus(string msg, color col).
Ah. that's what I get for only opening files to test. Will fix quickly. As for your datastream fix, will do. [editline]02:15PM[/editline] And on an unrelated note, is everyone happy with the rawio protection, Or do I need to add an option to enable/disable it?
[QUOTE=Levybreak;17105631] And on an unrelated note, is everyone happy with the rawio protection, Or do I need to add an option to enable/disable it?[/QUOTE] Options can be turned off by attackers.
[QUOTE=Lexic;17106135]Options can be turned off by attackers.[/QUOTE] I suppose so.
Alright, V1.16: [url=http://www.garrysmod.org/downloads/?a=view&id=78065][img]http://www.garrysmod.org/img/?t=dll&id=78065[/img][/url] Mirror: [url]http://dl.getdropbox.com/u/99862/Luapad.zip[/url] Bugfixes: [list] [*]New works now, sorry for breaking it. [*]Datastream fix, fixed. [/list] New Features: [list] [*]"`" is ignored [*]There are now shortcuts to run things client (ctrl-g), server (ctrl-t), and shared (ctrl-b). [*]Admins may now run code on all clients. [/list] Possibly some other stuff I don't remember.
cant attackers also just use rawio directly?
"Upload denied by server! This is could be due to you not being an admin." (Spelling fail?) Anyway, I can't use luapad because it keeps giving me this error. And I am admin. I have put my name in settings/users.txt. How do I fix this?
[QUOTE=Divran;17137129]"Upload denied by server! This is could be due to you not being an admin." (Spelling fail?) Anyway, I can't use luapad because it keeps giving me this error. And I am admin. I have put my name in settings/users.txt. How do I fix this?[/QUOTE] I haven't changed the upload system since the original (hence why "is" is still in there), and it seemed to work then... are you talking about a dedicated server? I've never tested it on one of those. Are you absolutely sure you're an admin? (You can spawn admin weapons and such?) I've uploaded code successfully before in SP and listen server... Do you have any other addons that could be hooking into datastream's AcceptStream hook, making luapad's streams be refused? I'll change the hook's wording to make it work better... [editline]11:08AM[/editline] [QUOTE=TomyLobo;17125968]cant attackers also just use rawio directly?[/QUOTE] There's some rawio protection in this addon that limits it to reading/writing .lua and .txt files within the garrysmod/garrysmod folder. And the delete function is completely overridden. So yes, you could still have you gmod folder spammed with .txt files, but that's about the same as your data folder being spammed with txt files (which you can do with vanilla GM lua), though. Using rawio is your choice, though. You don't have to use it. If you don't, you'll just be limited to the data folder and writing .txt files.
The uploading works fine on singleplayer, and on a dedicated server (with basic addons such as Wire, PHX3, Stargate, etc). However, some of my friends have also complained about it being broken, so I guess it has something to do with the hook.
[url=http://www.garrysmod.org/downloads/?a=view&id=78199][img]http://www.garrysmod.org/img/?t=dll&id=78199[/img][/url] Tell me if this works, please. My perception of the logic says it should, so... *coughs* fixed bug. re download it. (to the 2 of you who did before the re-upload)
[QUOTE=Levybreak;17138528]I haven't changed the upload system since the original (hence why "is" is still in there), and it seemed to work then... are you talking about a dedicated server? I've never tested it on one of those. Are you absolutely sure you're an admin? (You can spawn admin weapons and such?) I've uploaded code successfully before in SP and listen server...[/QUOTE] I'm sure I'm an admin on the server. Yes I can spawn admin weapons. I can also use stuff that is set to "if (ply:IsAdmin()) then" and "if (ply:IsSuperAdmin()) then". I'll test the fix soon. EDIT: Tested the fix. Got the exact same error.
If you have some other addons that use datastream try removing/disabling them for a while.
It could be my custom admin mod. I joined a different server where I was admin and it worked fine there. Oh well I'll be switching admin mod soon so nevermind.
I seem to be getting "Upload denied by server! This is could be due to you not being an admin." even in single player, I'll try the fix and see if it helps but its really starting to get annoying. [editline]Edited:[/editline] Nope, fix didn't help.
Sorry, you need to Log In to post a reply to this thread.