Skip to content

Instantly share code, notes, and snippets.

@Python1320
Created June 18, 2014 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Python1320/862abef8ad42c2839160 to your computer and use it in GitHub Desktop.
Save Python1320/862abef8ad42c2839160 to your computer and use it in GitHub Desktop.
Gmod Lua Syntax Checker for SVNs
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <stdio.h>
static const char *getF(lua_State *L, void *ud, size_t *size)
{
FILE *f=(FILE *)ud;
static char buff[512];
if (feof(f)) return NULL;
*size=fread(buff,1,sizeof(buff),f);
return (*size>0) ? buff : NULL;
}
int main(int argc, char *argv[])
{
int status, result, i;
double sum;
lua_State *L;
L = luaL_newstate();
luaL_openlibs(L);
status = lua_load(L,getF,stdin,"=");
if (status) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
exit(1);
}
exit(0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment