Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Error when accessing a nonexistant GL constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColonelThirtyTwo committed Jul 26, 2014
1 parent d969f1a commit dcfb37d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions glfw_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local jit = require "jit"

local Lib = {}

setmetatable(glc, {__index=function(self, k) error("Unknown GL constant: "..k) end})

-- Load and export libraries
local gl, glu, glfw
if ffi.os == "Windows" then
Expand Down
2 changes: 2 additions & 0 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ local bit = require "bit"
-- Localize the FFI libraries
local gl, glc, glu, glfw, glext = lj_glfw.libraries()

assert(pcall(function() local _ = glc.this_doesnt_exist end) == false)

-- Define vertex arrays for the model we will draw
local CubeVerticies = {}
CubeVerticies.v = ffi.new("const float[8][3]", {
Expand Down

0 comments on commit dcfb37d

Please sign in to comment.